GCC configure data: system type... i686-pc-cygwin target system type... powerpc-xcoff-lynxos build system type... i686-pc-cygwin
gcc -v Reading specs from /cross_compiler/tools/cygwin_ppc_gnu/lib/gcc/ppc-xcoff-lynxos/4.1.1/specs Target: ppc-xcoff-lynxos Configured with: gcc-4.1.1/configure --target=ppc-xcoff-lynxos --verbose --prefix=/cross_compiler/tools --exec-prefix=/cross_compile r/tools/cygwin_ppc_gnu --with-gnu-as --with-gnu-ld --with-sysroot=/cross_compiler/tools/cygwin_ppc_gnu/ppc-xcoff-lynxos --enable-lan guages=c,ada --enable-threads=gnat --disable-multilib --enable-shared --with-cpu=750 -v Thread model: lynx gcc version 4.1.1 GCC ADA version 4.1.1 I have an erroneous behaviour of the GCC-ADA compiler when a procedure having the parameter 'in out' is called passing, has argument, a component of a record (nested record) having a representation clause. The 'in out' parameter, modified by the procedure, at the caller level remains unchanged. Without one representation clause (specifyed below) the behaviuor is corret. I attached the source file necessary to repeat the problem. The package pkg_test.adb contains the code having wrong behaviour. The procedure prova call (at line 61) the procedure Set_3D_NotEngJust passing as argument 'T.DATA.INT_3D_TRACK_DATA.NOT_ENG_PROP_JUSTIFICATION' (packed bit array 0..31 of boolean). The procedure Set_3D_NotEngJust change the corresponding Into parameter (in out) but, at the end of the procedure, the parameter 'T.DATA.INT_3D_TRACK_DATA.NOT_ENG_PROP_JUSTIFICATION' doesn't have the values modified. Without the representation clause reported in file MSG_TYPES_S at line 489: INT_3D_TRACK_DATA at 4 * UNITSIZE range 0 .. (201 * 16) - 1; the error is not present. I use the following command: gcc -S pkg_test.adb to examine the assembler. Examining the asm source code produced by gcc (I dont have many experience in the PPC assembler) it seems that the compiler pass the argument by value and not by reference as the 'Passed_By_Reference attribute instead report. Without the representation clause at line 489 the parameter is passed by reference. Passing the parameter by copy the compiler add 2 asm instruction: . line #843 stw 0,88(31) . line #844 addi 0,31,88 that modify the correct value in the r0 register producing the error. I have tryed to modifiy the procedure prova by adding the following asm instruction lwz 0,88(31) lwz 9,952(31) stw 0,234(9) after the call of the procedure Set_3D_NotEngJust (line 62) and the program works correctly. If I reduce the number of the fields of the record REC_INTERNAL_3D_TRACK_DATA eliminate the fields after KILL_PROBABILITY the program works correctly. One workaround found to allows the compiler to produce the correct code is adding the folowing pragma: pragma export_procedure (Internal => Set_3D_NotEngJust, External => "Set_3D_NotEngJust", Mechanism => (Into => Value, TheReason => Value)); In this manner the parameters are always passed by value and the problem doesn't arise. Please doesn't esitate to mail me for any further information you need. PS: sorry for my english -- Summary: gcc 4.1.1: procedure doesn't modify a parameters of type 'in out' Product: gcc Version: 4.1.1 Status: UNCONFIRMED Severity: critical Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: mbo dot massimo at tiscali dot it GCC build triplet: i686-pc-cygwin GCC host triplet: i686-pc-cygwin GCC target triplet: powerpc-xcoff-lynxos http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29025