egcs 980315 bug on powerpc-unknown-linux-gnulibc1

Franz Sirl Franz.Sirl-kernel@lauterbach.com
Sat May 16 05:13:00 GMT 1998


At 5:25 Uhr -0000 16.05.1998, Jeffrey A Law wrote:
>  In message <v03130301b13b277bfe8c@[195.180.235.165]>you write:
>  > I think for globc.c you still need the case-folding patch from Geoff's
>  > patch set. It's not checked in yet to egcs.
>Hmmm, I don't remember that one.  Can you send me a pointer to it
>(unfortunately, since I thought we had addressed all of his patches,
>so I don't have the message with the

Ok, I think it's time for a status report for powerpc-unknown-linux-gnu.
Geoff's patch set (against 1.0.1/2) is available at
< http://discus.anu.edu.au/~geoffk >.
For your convienence I've included a diff against CVS with additional
patches and some comments.


The first patch is out of Geoff's patch set, see the comment there.

Index: gcc/config/rs6000/linux.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/linux.h,v
retrieving revision 1.7
diff -u -r1.7 linux.h
--- linux.h	1998/03/04 20:59:50	1.7
+++ linux.h	1998/05/16 10:53:23
@@ -26,7 +26,7 @@
  "-DPPC -D__ELF__ -Dunix -Dlinux -Dpowerpc -Asystem(unix) -Asystem(linux)
-Acpu(powerpc) -Amachine(powerpc)"

 #undef LINK_SPEC
-#define LINK_SPEC "-m elf32ppc %{shared:-shared} \
+#define LINK_SPEC "-m elf32ppc %{G*} %{shared:-shared} \
   %{!shared: \
     %{!static: \
       %{rdynamic:-export-dynamic} \



Gary Thomas produced part 1+3 of the next patch, part 2 is out of Geoff's
patch set.

Index: gcc/config/rs6000/rs6000.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.c,v
retrieving revision 1.21
diff -u -r1.21 rs6000.c
--- rs6000.c	1998/05/15 17:44:21	1.21
+++ rs6000.c	1998/05/16 10:53:52
@@ -3889,6 +3889,25 @@
   int sp_reg = 1;
   int sp_offset = 0;

+  /* Give an error if we detect that this is a function with incoming varargs
+     and it calls another function that required stack argument overflow.
This
+     will destroy the varargs information. This is because the varargs
information
+     (both control structures and actual incoming [non varargs] arguments) are
+     kept on the stack.  The outgoing call will write over these when setting
+     up the argument list.  Indeed, the generated code will also be incorrect
+     because the offset in the stack frame to the varargs info will move after
+     the outgoing call!  All this is because the offset to the varargs info is
+     computed during the generation/scanning of the function and it is based
+     on information which cannot be known until the function has been totally
+     processed.  The only known "error" is that the varargs info will be
destroyed.
+     Since I don't know how to fix this properly, this will generate a
+     warning condition. (Only for SVR4 ABI) Note: in some cases this is
not a problem */
+  if ((DEFAULT_ABI == ABI_V4 || DEFAULT_ABI == ABI_SOLARIS) &&
+      (current_function_outgoing_args_size > 0) &&
+      (info->varargs_size > 0)) {
+    warning("varargs function required outgoing stack arguments");
+  }
+
   /* If the last insn was a BARRIER, we don't have to write anything except
      the trace table.  */
   if (GET_CODE (insn) == NOTE)
@@ -4523,7 +4542,7 @@
 #endif
       else if (TARGET_NEW_MNEMONICS)
 	{
-	  fprintf (file, "\taddis %s,%s,", reg_names[11], reg_names[11]);
+	  fprintf (file, "\tlis %s,", reg_names[11]);
 	  assemble_name (file, buf);
 	  fprintf (file, "@ha\n");
 	  fprintf (file, "\tstw %s,4(%s)\n", reg_names[0], reg_names[1]);
@@ -4733,7 +4752,7 @@
     case ABI_V4:
     case ABI_SOLARIS:
     case ABI_AIX_NODESC:
-      ret = (TARGET_32BIT) ? 40 : 48;
+      ret = 48;  /* Keeps stack aligned */
       break;

     case ABI_NT:


The next patch I did myself to fix some warnings, no test regression.

Sat May 16 11:12:00 1998 Franz Sirl <franz.sirl-kernel@lauterbach.com>
	* rs6000/rs6000.md: warning fixes

Index: gcc/config/rs6000/rs6000.md
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/rs6000.md,v
retrieving revision 1.15
diff -u -r1.15 rs6000.md
--- rs6000.md	1998/05/06 21:08:00	1.15
+++ rs6000.md	1998/05/16 10:54:38
@@ -5724,6 +5724,9 @@
 {
   switch (which_alternative)
     {
+    default:
+      abort ();
+
     case 0:
       /* We normally copy the low-numbered register first.  However, if
 	 the first register operand 0 is the same as the second register of
@@ -5769,6 +5772,9 @@
 {
   switch (which_alternative)
     {
+    default:
+      abort ();
+
     case 0:
       /* We normally copy the low-numbered register first.  However, if
 	 the first register operand 0 is the same as the second register of
@@ -5915,6 +5921,9 @@
 {
   switch (which_alternative)
     {
+    default:
+      abort ();
+
     case 0:
       /* We normally copy the low-numbered register first.  However, if
 	 the first register operand 0 is the same as the second register of
@@ -6205,6 +6214,9 @@
 {
   switch (which_alternative)
     {
+    default:
+      abort ();
+
     case 0:
       /* We normally copy the low-numbered register first.  However, if
 	 the first register operand 0 is the same as the second register of




This next patch is again part of Geoff's patch set.


Index: gcc/config/rs6000/sysv4.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/sysv4.h,v
retrieving revision 1.7
diff -u -r1.7 sysv4.h
--- sysv4.h	1998/03/19 10:43:27	1.7
+++ sysv4.h	1998/05/16 10:54:44
@@ -429,12 +429,6 @@
 #define MINIMAL_TOC_SECTION_ASM_OP \
   ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".got2\",\"aw\"" :
"\t.section\t\".got1\",\"aw\"")

-/* Put relocatable data in .data, not .rodata so initialized pointers can
be updated */
-#undef	CONST_SECTION_ASM_OP
-#define CONST_SECTION_ASM_OP \
-  ((TARGET_RELOCATABLE || flag_pic) ? "\t.section\t\".data\"\t# .rodata" :
"\t.section\t\".rodata\"")
-
-
 #define SDATA_SECTION_ASM_OP "\t.section \".sdata\",\"aw\""
 #define SDATA2_SECTION_ASM_OP "\t.section \".sdata2\",\"a\""
 #define SBSS_SECTION_ASM_OP \
@@ -751,7 +745,7 @@
 #define ASM_OUTPUT_INT(FILE,VALUE)					\
 do {									\
   static int recurse = 0;						\
-  if ((TARGET_RELOCATABLE || flag_pic)					\
+  if ((TARGET_RELOCATABLE)						\
       && in_section != in_toc						\
       && in_section != in_text						\
       && in_section != in_ctors
	\




This one is by Gary Thomas again, sorry no comment available.

Index: gcc/config/rs6000/tramp.asm
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/rs6000/tramp.asm,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tramp.asm
--- tramp.asm	1997/12/06 17:28:15	1.1.1.2
+++ tramp.asm	1998/05/16 10:54:45
@@ -83,7 +83,7 @@
         lwz	r7,.Ltramp(r11)		/* trampoline address -4 */

 	li	r8,__trampoline_size	/* verify that the trampoline is
big enough */
-	cmpw	cr1,r8,r4
+	cmpw	cr1,r4,r8
 	srwi	r4,r4,2			/* # words to move */
 	addi	r9,r3,-4		/* adjust pointer for lwzu */
 	mtctr	r4



The next patch is from H.J. Lu (Mar 6 1998) and made it into the release
branch but not yet into the development branch and fixes a compatibility
problem with glibc-1.99.

Index: libstdc++/stl/stl_config.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/libstdc++/stl/stl_config.h,v
retrieving revision 1.5
diff -u -r1.5 stl_config.h
--- stl_config.h	1998/02/20 11:13:42	1.5
+++ stl_config.h	1998/05/16 10:55:16
@@ -114,7 +114,9 @@
 #     define __STL_EXPLICIT_FUNCTION_TMPL_ARGS
 #     define __STL_MEMBER_TEMPLATES
 #   endif
-#   if !defined(_NOTHREADS) && __GLIBC__ >= 2
+    /* glibc pre 2.0 is very buggy. We have to disable thread for it.
+       It should be upgraded to glibc 2.0 or later. */
+#   if !defined(_NOTHREADS) && __GLIBC__ >= 2 && defined(_G_USING_THUNKS)
 #     define __STL_PTHREADS
 #   endif
 #   ifdef __EXCEPTIONS


You've probably noted that Geoff's fix for the case folding is missing.
That's because I no longer get testsuite failures for switch-1.c without
the patch. I also scanned back my egcs-Mailbox a little bit and found no
more FAILs on other platforms as well (mips?). It seems this has been fixed
in a general way now (that's probably also the reason why Geoff's patch was
not accepted, he fixed it in the rs6000-backend, as you can see in Geoff's
patch set).
As I've found no entries in the ChangeLog pointing to switch-1.c, I don't
know which change fixed that. If you know more about it, can you tell me if
the #define JUMP_TABLES_IN_TEXT_SECTION in rs6000/linux.h is also
superfluos now?

My current test results for gcc are (some comments on the compilation FAILs
below):
Test Run By root on Fri May 15 22:43:24 1998
Native configuration is powerpc-unknown-linux-gnu

		=== gcc tests ===

Running target unix
Running
/sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/code_quality/code_quality.exp
...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/compile/compile.exp ...
FAIL: gcc.c-torture/compile/920501-4.c,  -O2
FAIL: gcc.c-torture/compile/920501-4.c,  -O2 -fomit-frame-pointer
-finline-functions
FAIL: gcc.c-torture/compile/920501-4.c,  -O2 -fomit-frame-pointer
-finline-functions -funroll-loops
FAIL: gcc.c-torture/compile/920501-4.c,  -O2 -g
FAIL: gcc.c-torture/compile/980329-1.c,  -O2 -fomit-frame-pointer
-finline-functions -funroll-all-loops
FAIL: gcc.c-torture/compile/980511-1.c,  -O2
FAIL: gcc.c-torture/compile/980511-1.c,  -O2 -fomit-frame-pointer
-finline-functions
FAIL: gcc.c-torture/compile/980511-1.c,  -O2 -g
FAIL: gcc.c-torture/compile/980511-1.c,  -Os
Running /sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/execute/execute.exp ...
FAIL: gcc.c-torture/execute/980505-1.c execution,  -O2
FAIL: gcc.c-torture/execute/980505-1.c execution,  -O2 -fomit-frame-pointer
-finline-functions
FAIL: gcc.c-torture/execute/980505-1.c execution,  -O2 -g
FAIL: gcc.c-torture/execute/980505-1.c execution,  -Os
FAIL: gcc.c-torture/execute/980506-1.c execution,  -O2
FAIL: gcc.c-torture/execute/980506-1.c execution,  -O2 -g
FAIL: gcc.c-torture/execute/980506-1.c execution,  -Os
FAIL: gcc.c-torture/execute/complex-5.c execution,  -O2
-fomit-frame-pointer -finline-functions
Running /sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/execute/ieee/ieee.exp ...
Running
/sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/noncompile/noncompile.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/special/special.exp ...
FAIL: gcc.c-torture/special/920520-1.c,  -O0  -S
FAIL: gcc.c-torture/special/920520-1.c,  -O1  -S
FAIL: gcc.c-torture/special/920520-1.c,  -O2  -S
FAIL: gcc.c-torture/special/920520-1.c,  -O2 -fomit-frame-pointer
-finline-functions  -S
FAIL: gcc.c-torture/special/920520-1.c,  -O2 -g  -S
FAIL: gcc.c-torture/special/920520-1.c,  -Os  -S
Running /sda9/src/e/egcs/gcc/testsuite/gcc.c-torture/unsorted/unsorted.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.dg/dg.exp ...
FAIL: gcc.dg/980502-1.c (test for excess errors)
Running /sda9/src/e/egcs/gcc/testsuite/gcc.failure/failure.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/acker1.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/dg-test.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/dhry.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/gcov.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/matrix1.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/mg.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/msgs.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/optbench.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/sieve.exp ...
Running /sda9/src/e/egcs/gcc/testsuite/gcc.misc-tests/sort2.exp ...

		=== gcc Summary ===

# of expected passes		7204
# of unexpected failures	24
# of expected failures		7
# of unsupported tests		14
/sda9/src/e/obj/cvs1/gcc/xgcc version egcs-2.91.28 19980508 (gcc2 ss-980502
experimental)


Comments:
gcc.c-torture/compile/920501-4.c: The infamous "Couldn't find a spill
register" bug
gcc.c-torture/compile/980329-1.c: SIGSEGV, already reported with gdb-backtrace
gcc.c-torture/compile/980511-1.c: the combiner bug, how did you extract a
small testcase so fast? Experience or tools/scripts? I wasn't really
successful at minimizing :-( ;-)
gcc.c-torture/special/920520-1.c: compiler exited with status 1
output is:
../../../egcs/gcc/emit-rtl.c:1474: Internal compiler error in function
change_address


And finally, as promised, a testcase for the "needed additional GOT" abort.

gcc/testsuite/gcc.dg/tclXmath-min.c:
/* { dg-do compile } */
/* { dg-options "-O2 -fpic" } */

int
test(void)
{
    double value, maxValue = - (__extension__	((union { unsigned __l
__attribute__((__mode__(__DI__))); double __d; }) { __l:
0x7ff0000000000000ULL }).__d)  ;
    int idx, maxIdx = 1;

    for (idx = 1; idx < 22; idx++) {
        if (value > maxValue) {
            maxValue = value;
            maxIdx = idx;
        }
    }
    return 0 ;
}


I think that's all for now. I still have to investigate a miscompilation in
the linux-kernel, but I have no further info yet.

Bye,
Franz.





More information about the Gcc-bugs mailing list