This is the mail archive of the gcc-patches@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]

Re: va_list: ppc


Am Don, 29 Jul 1999 schrieb Franz Sirl:
>At 11:14 29.07.99 , Richard Henderson wrote:
>>Eyeballed.  Would one of the ppc-linux folks sick the test suite
>>on this for good measure?
>
>I haven't looked into the failures further yet, but I have the impression 
>it's only one common problem. Unless the fix is obvious to you, I'll debug 
>it later today.

I debugged this stuff a little and the appended patch against yours fixes all C
problems I encountered. I think one change additionally is needed, va_list on
PPC/SYSV is an array type, so the whole struct has to be put in an array.

Unfortunately I still cannot bootstrap, compilation stops while compiling libio.

[fsirl@kernel:~/obj/gccm/ppc-redhat-linux/libio]$ /home/fsirl/obj/gccm/gcc/xgcc -B/home/fsirl/obj/gccm/gcc/stage2/ -B/home/fsirl/g
nubin/ppc-redhat-linux/bin/ -c -g -O2 -fvtable-thunks -D_GNU_SOURCE -fno-implicit-templates -I. -I../../../../cvsx/gccm/libio -nos
tdinc++ -D_IO_MTSAFE_IO -fPIC ../../../../cvsx/gccm/libio/builtinbuf.cc -o pic/builtinbuf.o -v -save-temps
Reading specs from /home/fsirl/obj/gccm/gcc/stage2/specs
gcc version 2.96 19990729 (experimental)
 /home/fsirl/obj/gccm/gcc/stage2/cpp -lang-c++ -nostdinc++ -v -I. -I../../../../cvsx/gccm/libio -isystem /home/fsirl/gnubin/ppc-re
dhat-linux/bin/include -isystem /home/fsirl/obj/gccm/gcc/include -isystem /home/fsirl/obj/gccm/gcc/stage2/include -D__GNUC__=2 -D_
_GNUG__=2 -D__GNUC_MINOR__=96 -D__cplusplus -DPPC -D__ELF__ -Dpowerpc -D__PPC__ -D__ELF__ -D__powerpc__ -D__PPC -D__powerpc -Acpu(
powerpc) -Amachine(powerpc) -D__EXCEPTIONS -D__CHAR_UNSIGNED__ -D__OPTIMIZE__ -g -D__PIC__=2 -D__pic__=2 -D_CALL_SYSV -D_BIG_ENDIA
N -D__BIG_ENDIAN__ -Amachine(bigendian) -D_ARCH_PPC -D__unix__ -D__linux__ -Dunix -Dlinux -Asystem(unix) -Asystem(posix) -D_GNU_SO
URCE -D_IO_MTSAFE_IO ../../../../cvsx/gccm/libio/builtinbuf.cc builtinbuf.ii
GNU CPP version 2.96 19990729 (experimental) (PowerPC GNU/Linux)
#include "..." search starts here:
#include <...> search starts here:
 .
 ../../../../cvsx/gccm/libio
 /home/fsirl/obj/gccm/gcc/include
 /usr/local/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
 /home/fsirl/gnubin/lib/gcc-lib/ppc-redhat-linux/2.96/../../../../include/g++-3
 /home/fsirl/gnubin/lib/gcc-lib/ppc-redhat-linux/2.96/../../../../ppc-redhat-linux/include
 /home/fsirl/gnubin/lib/gcc-lib/ppc-redhat-linux/2.96/include
End of omitted list.
 /home/fsirl/obj/gccm/gcc/stage2/cc1plus builtinbuf.ii -quiet -dumpbase builtinbuf.cc -g -O2 -version -fvtable-thunks -fno-implici
t-templates -fPIC -o builtinbuf.s
GNU C++ version 2.96 19990729 (experimental) (ppc-redhat-linux) compiled by GNU C version 2.96 19990729 (experimental).
In file included from ../../../../cvsx/gccm/libio/streambuf.h:36,
                 from ../../../../cvsx/gccm/libio/builtinbuf.h:32,
                 from ../../../../cvsx/gccm/libio/builtinbuf.cc:29:
../../../../cvsx/gccm/libio/libio.h:345: Internal compiler error.
../../../../cvsx/gccm/libio/libio.h:345: Please submit a full bug report.
../../../../cvsx/gccm/libio/libio.h:345: Internal compiler error:
../../../../cvsx/gccm/libio/libio.h:345: See <URL:http://egcs.cygnus.com/faq.html#bugreport> for instructions.

(gdb) r builtinbuf.ii -quiet -dumpbase builtinbuf.cc -g -O2 -version -fvtable-thunks -fno-implicit-templates -fPIC -o builtinbuf.s
Starting program: /home/fsirl/obj/gccm/gcc/cc1plus builtinbuf.ii -quiet -dumpbase builtinbuf.cc -g -O2 -version -fvtable-thunks -fno-implicit-templates -fPIC -o builtinbuf.s
GNU C++ version 2.96 19990731 (experimental) (ppc-redhat-linux) compiled by GNU C version 2.96 19990731 (experimental).

Program received signal SIGSEGV, Segmentation fault.
0x10256980 in search_tree (t=0x103421d0, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1753
1753          if (TYPE_PTRMEMFUNC_P (t))
(gdb) bt
#0  0x10256980 in search_tree (t=0x103421d0, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1753
#1  0x102567dc in search_tree (t=0x10398c10, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1592
#2  0x102569ac in search_tree (t=0x10398bf8, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1754
#3  0x102569ac in search_tree (t=0x10398be0, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1754
#4  0x102569ac in search_tree (t=0x10398e50, func=0x102569f4 <no_linkage_helper>) at ../../../../cvsx/gccm/gcc/cp/tree.c:1754
#5  0x10256ae0 in no_linkage_check (t=0x0) at ../../../../cvsx/gccm/gcc/cp/tree.c:1792
#6  0x101e5348 in grokfndecl (ctype=0x0, type=0x10398e50, declarator=0x10398b90, orig_declarator=0x10398b90, virtualp=0,
    flags=NO_SPECIAL, quals=0x0, raises=0x102569f4, check=1, friendp=0, publicp=1, inlinep=0, funcdef_flag=0, template_count=0,
    in_namespace=0x0) at ../../../../cvsx/gccm/gcc/cp/decl.c:8456
#7  0x101e9c3c in grokdeclarator (declarator=0x10398b90, declspecs=0x10395ae0, decl_context=NORMAL, initialized=0, attrlist=0x0)
    at ../../../../cvsx/gccm/gcc/cp/decl.c:11243
#8  0x101e2b3c in start_decl (declarator=0x10395c18, declspecs=0x10395ae0, initialized=0, attributes=0x0, prefix_attributes=0x0)
    at ../../../../cvsx/gccm/gcc/cp/decl.c:6877
#9  0x10226a64 in parse_decl (declarator=0x10395c18, specs_attrs=0x102569f4, attributes=0x0, initialized=0, decl=0x7ffff208)
    at parse.y:332
#10 0x10228ec4 in yyparse () at parse.y:1931
#11 0x100044b0 in compile_file (name=0x10310000 <Address 0x10310000 out of bounds>) at ../../../cvsx/gccm/gcc/toplev.c:3271
#12 0x100080b4 in main (argc=13, argv=0x7ffffb84) at ../../../cvsx/gccm/gcc/toplev.c:5443
#13 0xfedcdb4 in __libc_start_main () at ../sysdeps/powerpc/elf/libc-start.c:106
(gdb) l
1748          TRY (TREE_TYPE (t));
1749          TRY (TYPE_OFFSET_BASETYPE (t));
1750          break;
1751
1752        case RECORD_TYPE:
1753          if (TYPE_PTRMEMFUNC_P (t))
1754            TRY (TYPE_PTRMEMFUNC_FN_TYPE (t));
1755          break;
1756
1757          /*  This list is incomplete, but should suffice for now.
(gdb) p debug_tree(t)
 <record_type 0x103421d0 __builtin_va_list allocated from permanent_obstack
    permanent BLK
    size <integer_cst 0x10342598 type <integer_type 0x1033ed50 unsigned int> constant permanent 96>
    align 32 symtab 21 alias set -1
    fields <field_decl 0x103422f0 gpr
        type <integer_type 0x10342230 allocated from permanent_obstack
            unsigned permanent QI
            size <integer_cst 0x1033eac0 constant permanent 8>
            align 8 symtab 22 alias set -1 precision 8
            min <integer_cst 0x10342290 constant permanent 0>
            max <integer_cst 0x103422a8 constant permanent 255>>
        allocated from permanent_obstack
        unsigned permanent QI file <internal> line 0 size <integer_cst 0x1033eac0 8>
        align 8
        bitpos <integer_cst 0x10341958 constant permanent 0> context <record_type 0x103421d0 __builtin_va_list> arguments <integer_cst 0x10341958 0>
        chain <field_decl 0x10342388 fpr type <integer_type 0x10342230>
            allocated from permanent_obstack
            unsigned permanent QI file <internal> line 0 size <integer_cst 0x1033eac0 8>
            align 8
            bitpos <integer_cst 0x1033d800 constant permanent 8> context <record_type 0x103421d0 __builtin_va_list> arguments <integer_cst 0x1033d800 8> chain <field_decl 0x10342430 overflow_arg_area>>>
    pointer_to_this <pointer_type 0x10342688>>

If you need to know anything else, please let me know.

Franz.


--- rs6000.c~	Sat Jul 31 14:13:45 1999
+++ rs6000.c	Sat Jul 31 14:18:50 1999
@@ -1837,14 +1842,9 @@ rs6000_va_start (stdarg_p, valist, nexta
   n_gpr = current_function_args_info.sysv_gregno - GP_ARG_MIN_REG;
   n_fpr = current_function_args_info.fregno - FP_ARG_MIN_REG;
 
-  /* Varargs has the va_dcl argument, but we don't count it.  */
-  if (!stdarg_p)
-    {
-      if (n_gpr > GP_ARG_NUM_REG)
-        words -= 1;
-      else
-        n_gpr -= 1;
-    }
+  if (TARGET_DEBUG_ARG)
+    fprintf (stderr, "va_start: words = %d, n_gpr = %d, n_fpr = %d\n",
+	     words, n_gpr, n_fpr);
 
   t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_2 (n_gpr, 0));
   TREE_SIDE_EFFECTS (t) = 1;
@@ -1986,6 +1986,7 @@ rs6000_va_arg (valist, type)
     {
       t = build (MODIFY_EXPR, TREE_TYPE (reg), reg, build_int_2 (8, 0));
       TREE_SIDE_EFFECTS (t) = 1;
+      expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
 
   /* Care for on-stack alignment if needed.  */
--- rs6000.c~	Sat Jul 31 14:13:45 1999
+++ rs6000.c	Sat Jul 31 14:18:50 1999
@@ -1837,14 +1842,9 @@ rs6000_va_start (stdarg_p, valist, nexta
   n_gpr = current_function_args_info.sysv_gregno - GP_ARG_MIN_REG;
   n_fpr = current_function_args_info.fregno - FP_ARG_MIN_REG;
 
-  /* Varargs has the va_dcl argument, but we don't count it.  */
-  if (!stdarg_p)
-    {
-      if (n_gpr > GP_ARG_NUM_REG)
-        words -= 1;
-      else
-        n_gpr -= 1;
-    }
+  if (TARGET_DEBUG_ARG)
+    fprintf (stderr, "va_start: words = %d, n_gpr = %d, n_fpr = %d\n",
+	     words, n_gpr, n_fpr);
 
   t = build (MODIFY_EXPR, TREE_TYPE (gpr), gpr, build_int_2 (n_gpr, 0));
   TREE_SIDE_EFFECTS (t) = 1;
@@ -1986,6 +1986,7 @@ rs6000_va_arg (valist, type)
     {
       t = build (MODIFY_EXPR, TREE_TYPE (reg), reg, build_int_2 (8, 0));
       TREE_SIDE_EFFECTS (t) = 1;
+      expand_expr (t, const0_rtx, VOIDmode, EXPAND_NORMAL);
     }
 
   /* Care for on-stack alignment if needed.  */

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