This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Problem with gcc 2.95.1/-O2 on Linux/Alpha


The problem: The Oberon to C compiler oo2c_64 fails to compile with
gcc 2.95.1 using the CFLAGS "-O2 -g" on Linux/Alpha, but can be
installed successfully using "-O1 -g".  The target machine and gcc in
question are

  $ hostname -f
  faure.debian.org
  $ uname -a
  Linux faure 2.2.9 #1 Fri May 21 23:08:39 CDT 1999 alpha unknown
  $ gcc -v
  Reading specs from /usr/lib/gcc-lib/alpha-linux/2.95.1/specs
  gcc version 2.95.1 19990816 (release)

The specs file is attached to this mail.  I don't have any information
which configure call was used to install gcc on this machine.


Because the program in question is the output of a pre-compiler (and
not very readable), I cannot break it down into a handy test case for
you within a reasonable time frame.  But I can tell you how to
reproduce the error, and point out the very small code window where I
believe gcc is getting things wrong.

----

Get the oo2c tar ball at

  ftp://ftp.de.uu.net/pub/programming/languages/oberon/www.uni-kl.de/OOC/files/oo2c/oo2c_64-1.4.6.tar.gz

and apply this patch to add some debug output to the program:

------------------------------------------------------------------------
diff -Nru oo2c_64-1.4.6-orig/src.c/ParamPaths.c oo2c_64-1.4.6/src.c/ParamPaths.c
--- oo2c_64-1.4.6-orig/src.c/ParamPaths.c       Sun Aug  8 14:56:20 1999
+++ oo2c_64-1.4.6/src.c/ParamPaths.c    Fri Sep 10 20:18:38 1999
@@ -206,6 +206,7 @@
   if (!(i2)) goto l10;
   h3 = 0;
 l10:
+printf("A: adr=%lx, value=%d\n", (long int)ParamPaths__ParsePatterns_sym, *ParamPaths__ParsePatterns_sym);
   return (void*)h3;
 }
 
@@ -429,7 +430,9 @@
   if (i5) goto l7;
   sym = (signed char)2;
   sym = (signed char)2;
+printf("Calling ParamPaths__ParsePatterns_PathList\n");
   h1 = (hugeint)ParamPaths__ParsePatterns_PathList((unsigned char)1, str, &sym, &includeEnd);
+printf("B: adr=%lx, value=%d\n", (long int)&sym, sym);
   i5 = sym;
   i2 = includeEnd;
   goto l8;
------------------------------------------------------------------------

Then try to build the program:

  CFLAGS="-O2 -g" ./configure --disable-gc --disable-libs
  make

On faure this ends when the program `stage1/oo2c' (built from the
source files in src.c/) is called for the first time:

| [...]
| if test no = yes; then \
|   stage1/oo2c --config oo2crc.stage2 --libtool-cmd /usr/bin/libtool --make-lib --lib-path /usr/local/lib liboo2c && touch liboo2c; \
| else \
|   stage1/oo2c --config oo2crc.stage2 -Mv liboo2c; \
| fi
| Calling ParamPaths__ParsePatterns_PathList
| A: adr=11ffff930, value=1
| B: adr=11ffff930, value=0
| Error in oo2crc.stage2 at pos 861:
| GET expected
| make: *** [liboo2c] Error 1

The error message is wrong, the problem is summarized by the output
lines A and B: at the very end of the function
  ParamPaths__ParsePatterns_PathList 
  (file oo2c_64-1.4.6/src.c/ParamPaths.c, line 148)
the value at the indicated address is reported as `1' (output A),
while directly after the call to this function, the same address is
reported to have the value `0' (output B).  "A" is correct, but
somehow the correct value does not show up in memory, or is
overwritten in between.  Btw, the same happens if -fno-strict-aliasing
is set.


On the other hand, when building with -O1, the Makefile completes all
rules without any errors:

  make distclean 
  CFLAGS="-O1 -g" ./configure --disable-gc --disable-libs
  make

In particular, the first occurence of the debug output looks like this:

| [...]
| Calling ParamPaths__ParsePatterns_PathList
| A: adr=11ffff940, value=1
| B: adr=11ffff940, value=1
| [...]


Drop me a note if you need any additional information.

Regards,
Michael van Acken



------------------------------------------------------------------------
file: /usr/lib/gcc-lib/alpha-linux/2.95.1/specs
------------------------------------------------------------------------
*asm: %{G*} %{relax:-relax} %{gdwarf*:-no-mdebug}

*asm_final:


*cpp:
%{!undef:%{.S:-D__LANGUAGE_ASSEMBLY__ -D__LANGUAGE_ASSEMBLY %{!ansi:-DLANGUAGE_ASSEMBLY }}%{.cc|.cxx|.C:-D__LANGUAGE_C_PLUS_PLUS__ -D__LANGUAGE_C_PLUS_PLUS -D__cplusplus }%{.m:-D__LANGUAGE_OBJECTIVE_C__ -D__LANGUAGE_OBJECTIVE_C }%{!.S:%{!.cc:%{!.cxx:%{!.C:%{!.m:-D__LANGUAGE_C__ -D__LANGUAGE_C %{!ansi:-DLANGUAGE_C }}}}}}%{mieee:-D_IEEE_FP }%{mieee-with-inexact:-D_IEEE_FP -D_IEEE_FP_INEXACT }}%(cpp_cpu) %(cpp_subtarget)

*cc1:
%{G*}

*cc1plus:


*endfile:
crtend.o%s crtn.o%s

*link:
-m elf64alpha %{G*} %{relax:-relax}		  %{O*:-O3} %{!O*:-O1}						  %{shared:-shared}						  %{!shared:							    %{!static:							      %{rdynamic:-export-dynamic}				      %{!dynamic-linker:-dynamic-linker %(elf_dynamic_linker)}}	    %{static:-static}}

*lib:
%{shared:-lc}%{!shared:%{pthread:-lpthread }%{profile:-lc_p}%{!profile:-lc}} 

*libgcc:
-lgcc

*startfile:
%{!shared:      %{pg:gcrt1.o%s} %{!pg:%{p:gcrt1.o%s} %{!p:crt1.o%s}}}   crti.o%s crtbegin.o%s

*switches_need_spaces:


*signed_char:
%{funsigned-char:-D__CHAR_UNSIGNED__}

*predefines:
-Dlinux -Dunix -Asystem(linux) -D_LONGLONG -D__alpha__ -D__ELF__

*cross_compile:
0

*version:
2.95.1

*multilib:
. !mieee;ieee mieee;

*multilib_defaults:


*multilib_extra:


*multilib_matches:
mieee mieee;

*linker:
collect2

*cpp_am_bwx:
-D__alpha_bwx__ -Acpu(bwx)

*cpp_am_max:
-D__alpha_max__ -Acpu(max)

*cpp_am_fix:
-D__alpha_fix__ -Acpu(fix)

*cpp_am_cix:
-D__alpha_cix__ -Acpu(cix)

*cpp_im_ev4:
-D__alpha_ev4__ -Acpu(ev4)

*cpp_im_ev5:
-D__alpha_ev5__ -Acpu(ev5)

*cpp_im_ev6:
-D__alpha_ev6__ -Acpu(ev6)

*cpp_cpu_ev4:
%(cpp_im_ev4)

*cpp_cpu_ev5:
%(cpp_im_ev5)

*cpp_cpu_ev56:
%(cpp_im_ev5) %(cpp_am_bwx)

*cpp_cpu_pca56:
%(cpp_im_ev5) %(cpp_am_bwx) %(cpp_am_max)

*cpp_cpu_ev6:
%(cpp_im_ev6) %(cpp_am_bwx) %(cpp_am_max) %(cpp_am_fix)

*cpp_cpu_default:
%(cpp_im_ev4)

*cpp_cpu:
%{!undef:-Acpu(alpha) -Amachine(alpha) -D__alpha -D__alpha__ %{mcpu=ev4|mcpu=21064:%(cpp_cpu_ev4) }%{mcpu=ev5|mcpu=21164:%(cpp_cpu_ev5) }%{mcpu=ev56|mcpu=21164a:%(cpp_cpu_ev56) }%{mcpu=pca56|mcpu=21164pc|mcpu=21164PC:%(cpp_cpu_pca56) }%{mcpu=ev6|mcpu=21264:%(cpp_cpu_ev6) }%{!mcpu*:%(cpp_cpu_default) }}

*cpp_subtarget:


*elf_dynamic_linker:
/lib/ld-linux.so.2

*link_command:
%{!fsyntax-only:  %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} 			%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}			%{!A:%{!nostdlib:%{!nostartfiles:%S}}}			%{static:} %{L*} %D %o			%{!nostdlib:%{!nodefaultlibs:%G %L %G}}			%{!A:%{!nostdlib:%{!nostartfiles:%E}}}			%{T*}			
 }}}}}}



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]