Bug 32582 - Bootstrap with vectorization enabled fails with ICE on PPC
Summary: Bootstrap with vectorization enabled fails with ICE on PPC
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: regression (show other bugs)
Version: 4.3.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-07-02 09:58 UTC by Victor Kaplansky
Modified: 2007-11-14 12:22 UTC (History)
5 users (show)

See Also:
Host: powerpc64-unknown-linux-gnu
Target: powerpc64-unknown-linux-gnu
Build: powerpc64-unknown-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Victor Kaplansky 2007-07-02 09:58:12 UTC
Since revision 124727, mainline doesn't pass bootstrap wirh vectorization enabled on ppc.  It works OK on x86.  Revision 124727 was committed on 2007-05-15 by Zdenek Dvorak  <dvorakz@suse.cz>.


configured and built with:
  ../gcc/configure --prefix=/home/victork/mainline-vanila/usr.124727 \
      --enable-languages=c
  make bootstrap BOOT_CFLAGS="-g -O2 -ftree-vectorize -maltivec"

The result is:
[...]
/home/victork/mainline-20-06/build.124727/./prev-gcc/xgcc -B/home/victork/mainline-20-06/build.124727/./prev-gcc/ -B/home/victork/mainline-vanila/usr.124727/powerpc64-unknown-linux-gnu/bin/ -c   -g -O2 -ftree-vectorize -maltivec -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -Werror -fno-common   -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc/gcc/regclass.c -o regclass.o
../../gcc/gcc/regclass.c: In function 'init_regs':
../../gcc/gcc/regclass.c:579: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [regclass.o] Error 1
make[3]: Leaving directory `/home/victork/mainline-20-06/build.124727/gcc'
make[2]: *** [all-stage3-gcc] Error 2
make[2]: Leaving directory `/home/victork/mainline-20-06/build.124727'
make[1]: *** [stage3-bubble] Error 2
make[1]: Leaving directory `/home/victork/mainline-20-06/build.124727'
make: *** [bootstrap] Error 2

The failure is in the following command:
/home/victork/mainline-20-06/build.124727/./prev-gcc/cc1 -quiet -v -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber -iprefix /home/victork/mainline-20-06/build.124727/prev-gcc/../lib/gcc/powerpc64-unknown-linux-gnu/4.3.0/ -isystem /home/victork/mainline-20-06/build.124727/./prev-gcc/include -isystem /home/victork/mainline-20-06/build.124727/./prev-gcc/include-fixed -D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux -Asystem=linux -Asystem=unix -Asystem=posix -DIN_GCC -DHAVE_CONFIG_H ../../gcc/gcc/regclass.c -quiet -dumpbase regclass.c -maltivec -auxbase-strip regclass.o -g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -Werror -version -fno-common -o /tmp/ccQwGuJU.s

and it works OK if "-ftree-vectorize" is omitted.


I can add full make log if it is needed.
-- Victor
Comment 1 rakdver@kam.mff.cuni.cz 2007-07-02 10:06:50 UTC
Subject: Re:   New: Bootstrap with vectorization enabled fails with ICE on PPC

> Since revision 124727, mainline doesn't pass bootstrap wirh vectorization
> enabled on ppc.  It works OK on x86.  Revision 124727 was committed on
> 2007-05-15 by Zdenek Dvorak  <dvorakz@suse.cz>.
> ../../gcc/gcc/regclass.c: In function 'init_regs':
> ../../gcc/gcc/regclass.c:579: internal compiler error: Segmentation fault

Does the fix for PR 32230 fix this?
Comment 2 Victor Kaplansky 2007-07-02 11:47:45 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with
 ICE on PPC

"rakdver at kam dot mff dot cuni dot cz" <gcc-bugzilla@gcc.gnu.org> wrote
on 02.07.2007 13:06:50:

>
> Does the fix for PR 32230 fix this?
>

Patch for PR 32230 did not help, it fails in the same fasion.

Comment 3 Zdenek Dvorak 2007-07-02 11:51:34 UTC
OK, I will have a look.  Could you please provide a preprocessed source for the testcase, I need to use a crosscompiler to reproduce it?
Comment 4 Victor Kaplansky 2007-07-02 12:12:24 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with
 ICE on PPC



"rakdver at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote on
02.07.2007 14:51:35:

> OK, I will have a look.
thanks!

>  Could you please provide a preprocessed
> source for the
> testcase, I need to use a crosscompiler to reproduce it?

I'm using a native compiler and I'm not sure how easy it will be to
reproduce the
failure, as it happens during stage3 build using the compier from stage2
when
on "regclass.c" source. regclass.c passes the compilation when cc1 from
stage1 is used.

I've tried to get a backtrace using gdb, but I'm getting the following
error
from gdb:
(gdb) b main
Breakpoint 1 at 0x1009eac0: file ../../gcc/gcc/main.c, line 35.
(gdb) run
Starting program: /home/victork/mainline-20-06/build.124727/prev-gcc/cc1
-quiet -v -I. -I. -I../../gcc/gcc -I../../gcc/gcc/.
-I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include
-I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd
-I../libdecnumber -iprefix
/home/victork/mainline-20-06/build.124727/prev-gcc/../lib/gcc/powerpc64-unknown-linux-gnu/4.3.0
/ -isystem /home/victork/mainline-20-06/build.124727/./prev-gcc/include
-isystem /home/victork/mainline-20-06/build.124727/./prev-gcc/include-fixed
-D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux
-Asystem=linux -Asystem=unix -Asystem=posix -DIN_GCC -DHAVE_CONFIG_H
../../gcc/gcc/regclass.c -quiet -dumpbase regclass.c -maltivec
-auxbase-strip regclass.o -g -O2 -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long
-Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition
-Wmissing-format-attribute -Werror -version -ftree-vectorize -fno-common -o
x.s
Warning:
Cannot insert breakpoint -1.
Error accessing memory address 0x6a600000d692: Input/output error.

(gdb)

-- Victor

Comment 5 rakdver@kam.mff.cuni.cz 2007-07-02 15:27:21 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> "rakdver at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote on
> 02.07.2007 14:51:35:
> 
> > OK, I will have a look.
> thanks!
> 
> >  Could you please provide a preprocessed
> > source for the
> > testcase, I need to use a crosscompiler to reproduce it?
> 
> I'm using a native compiler and I'm not sure how easy it will be to
> reproduce the
> failure, as it happens during stage3 build using the compier from stage2
> when
> on "regclass.c" source. regclass.c passes the compilation when cc1 from
> stage1 is used.

With the same flags?  Strange.  Anyway, send me the preprocessed
source (possibly just to the mail), I will have a look.
Comment 6 Zdenek Dvorak 2007-07-26 12:09:30 UTC
rs6000_conditional_register_usage ();
memset (&reg_class_size, 0, 84);

gets compiled to

vxor    v0,v0,v0
...
bl      0x104f0c68 <rs6000_conditional_register_usage>
...
stvx    v0,r0,r9
addi    r9,r11,32
stw     r0,80(r11)
stvx    v0,r0,r11
addi    r11,r11,48
stvx    v0,r0,r27
stvx    v0,r0,r9
stvx    v0,r0,r11

The value of v0 gets changed inside rs6000_conditional_register_usage (some loop gets vectorized there and v0 is used), so we are not setting reg_class_size to zero, but to some random value.

I am not familiar with ppc abi -- is v0 call clobbered?
Comment 7 David Edelsohn 2007-07-26 12:53:13 UTC
v0 (and v10 are scratch registers and not saved.
Comment 8 dorit 2007-07-28 19:20:37 UTC
> v0 (and v10 are scratch registers and not saved.

so does it look like a register allocation bug then? 

Comment 9 rakdver@kam.mff.cuni.cz 2007-07-28 19:27:17 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> > v0 (and v10 are scratch registers and not saved.
> 
> so does it look like a register allocation bug then? 

not really; it seems like a md problem (the registers v0-v19
are not marked as call clobbered); the patch below should
fix the problem.

Index: testsuite/gcc.dg/pr32582.c
===================================================================
*** testsuite/gcc.dg/pr32582.c	(revision 0)
--- testsuite/gcc.dg/pr32582.c	(revision 0)
***************
*** 0 ****
--- 1,32 ----
+ /* { dg-do run { target { powerpc*-*-* && powerpc_altivec_ok } } } */
+ /* { dg-options "-O2 -ftree-vectorize -maltivec" } */
+ 
+ #include <stdlib.h>
+ #include <string.h>
+ 
+ char a[64];
+ 
+ void set (void)
+ {
+   int i;
+ 
+   for (i = 0; i < 64; i++)
+     a[i] = 'x';
+ }
+ 
+ void check (void)
+ {
+   int i;
+ 
+   for (i = 0; i < 64; i++)
+     if (a[i] != 0)
+       abort ();
+ }
+ 
+ int main (void)
+ {
+   set ();
+   memset (a, 0, sizeof a);
+   check ();
+   return 0;
+ }
Index: config/rs6000/rs6000.h
===================================================================
*** config/rs6000/rs6000.h	(revision 126932)
--- config/rs6000/rs6000.h	(working copy)
*************** extern enum rs6000_nop_insertion rs6000_
*** 699,706 ****
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,	   \
     /* AltiVec registers.  */			   \
!    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
!    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1						   \
     , 1, 1, 1                                       \
  }
--- 699,706 ----
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,	   \
     /* AltiVec registers.  */			   \
!    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
!    1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1						   \
     , 1, 1, 1                                       \
  }
*************** extern enum rs6000_nop_insertion rs6000_
*** 718,725 ****
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,	   \
     /* AltiVec registers.  */			   \
!    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
!    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     0, 0						   \
     , 0, 0, 0                                       \
  }
--- 718,725 ----
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1,	   \
     /* AltiVec registers.  */			   \
!    1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, \
!    1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \
     0, 0						   \
     , 0, 0, 0                                       \
  }
Comment 10 David Edelsohn 2007-07-28 19:40:10 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 

	Should this test be using -mabi=altivec or is there a general
assumption of -mabi=altivec when using autovec?  That conditionally sets
the call clobbered registers correctly.  I don't think the MD should
change for -maltivec.

David

Comment 11 Andrew Pinski 2007-07-28 19:45:10 UTC
This code in  rs6000_conditional_register_usage should have done the same thing as the patch posted:
  if (TARGET_ALTIVEC_ABI)
    for (i = FIRST_ALTIVEC_REGNO; i < FIRST_ALTIVEC_REGNO + 20; ++i)
      call_used_regs[i] = call_really_used_regs[i] = 1;

Comment 12 David Edelsohn 2007-07-28 19:48:28 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 

	And we default to ALTIVEC ABI for powerpc-linux:

  /* Set Altivec ABI as default for powerpc64 linux.  */
  if (TARGET_ELF && TARGET_64BIT)
    {
      rs6000_altivec_abi = 1;
      TARGET_ALTIVEC_VRSAVE = 1;
    }

So something else is wrong.

David

Comment 13 Andrew Pinski 2007-07-28 19:49:14 UTC
What happens if you add -mabi=altivec to the command line, does it work then?  If not, then that loop I pointed out is being miscompiled :).
Comment 14 rakdver@kam.mff.cuni.cz 2007-07-28 21:11:50 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> What happens if you add -mabi=altivec to the command line, does it work then? 
> If not, then that loop I pointed out is being miscompiled :).

that seems unlikely (I will check on Monday, I do not have access to a
ppc machine till then).  Probably the problem is that -maltivec does not
imply -mabi=altivec, or some similar omission.
Comment 15 David Edelsohn 2007-07-28 21:48:45 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 

>>>>> rakdver at kam dot mff dot cuni dot cz writes:

rakdver> Probably the problem is that -maltivec does not
rakdver> imply -mabi=altivec, or some similar omission.

	-maltivec does not imply -mabi=altivec, which is intended.

	The Bugzilla PR says the target is powerpc64-linux, which
implicitly should enable -mabi=altivec.  If this is some other target,
then the BOOT_CFLAGS should include -mabi=altivec.  Either something is
wrong with GCC enabling ALTIVEC_ABI or this is cockpit error in the
options used to bootstrap GCC that has been hidden until now.

David

Comment 16 rakdver@kam.mff.cuni.cz 2007-07-29 06:33:40 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> >>>>> rakdver at kam dot mff dot cuni dot cz writes:
> 
> rakdver> Probably the problem is that -maltivec does not
> rakdver> imply -mabi=altivec, or some similar omission.
> 
>         -maltivec does not imply -mabi=altivec, which is intended.
> 
>         The Bugzilla PR says the target is powerpc64-linux, which
> implicitly should enable -mabi=altivec.  If this is some other target,
> then the BOOT_CFLAGS should include -mabi=altivec.

it's on ppc-linux.  Nevertheless, it is suspicious that we allow a
fairly natural combination of flags (-O2 -maltivec -ftree-vectorize)
to cause misscompilation.
Comment 17 rakdver@kam.mff.cuni.cz 2007-07-29 07:16:29 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> > rakdver> Probably the problem is that -maltivec does not
> > rakdver> imply -mabi=altivec, or some similar omission.
> > 
> >         -maltivec does not imply -mabi=altivec, which is intended.
> > 
> >         The Bugzilla PR says the target is powerpc64-linux, which
> > implicitly should enable -mabi=altivec.  If this is some other target,
> > then the BOOT_CFLAGS should include -mabi=altivec.
> 
> it's on ppc-linux.

I mean, I did the testing on ppc-linux; it is possible that there is
another misscompilation on ppc64-linux, though.
Comment 18 David Edelsohn 2007-07-29 11:57:27 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 

>>>>> rakdver at kam dot mff dot cuni dot cz writes:

>> it's on ppc-linux.

rakdver> I mean, I did the testing on ppc-linux; it is possible that there is
rakdver> another misscompilation on ppc64-linux, though.

	The target in the PR says powerpc64-linux, which is what confused
Andrew and me.

	There is a valid mode of Altivec programming using builtins and
asms that does not require the Altivec ABI.  That is what -maltivec
supports.

	I suspect that -ftree-vectorize should enable -mabi=altivec by
default on PowerPC.

David

Comment 19 Victor Kaplansky 2007-07-30 11:08:57 UTC
I've tried to bootstrap with "-mabi=altivec", but it failed with the same error:

/home/victork/mainline-20-06/build.124727mabi/./prev-gcc/xgcc -B/home/victork/mainline-20-06/build.124727mabi/./prev-gcc/ -B/home/victork/mainline/usr.124727mabi/powerpc64-unknown-linux-gnu/bin/ -c   -g -O2 -ftree-vectorize -maltivec -mabi=altivec -DIN_GCC   -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute -Werror -fno-common   -DHAVE_CONFIG_H -I. -I. -I../../gcc/gcc -I../../gcc/gcc/. -I../../gcc/gcc/../include -I../../gcc/gcc/../libcpp/include  -I../../gcc/gcc/../libdecnumber -I../../gcc/gcc/../libdecnumber/dpd -I../libdecnumber    ../../gcc/gcc/regmove.c -o regmove.o
../../gcc/gcc/regclass.c: In function 'init_regs':
../../gcc/gcc/regclass.c:579: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[3]: *** [regclass.o] Error 1
make[3]: *** Waiting for unfinished jobs....
rm fsf-funding.pod gcov.pod gfdl.pod gpl.pod cpp.pod gfortran.pod gcc.pod
make[3]: Leaving directory `/home/victork/mainline-20-06/build.124727mabi/gcc'
make[2]: *** [all-stage3-gcc] Error 2
make[2]: Leaving directory `/home/victork/mainline-20-06/build.124727mabi'
make[1]: *** [stage3-bubble] Error 2
make[1]: Leaving directory `/home/victork/mainline-20-06/build.124727mabi'
make: *** [bootstrap] Error 2

Comment 20 rakdver@kam.mff.cuni.cz 2007-07-30 11:56:10 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> I've tried to bootstrap with "-mabi=altivec", but it failed with the same
> error:

yes, the problem on ppc64 must be something different
Comment 21 Victor Kaplansky 2007-07-31 11:57:22 UTC
Just to be sure that the problem on ppc64 is not related to a problem with passing -mabi during bootstrap I've tried to build with the patch from
http://gcc.gnu.org/ml/gcc-patches/2007-07/msg02159.html
but it didn't help and bootstrap still fails in the same manner.
Comment 22 Victor Kaplansky 2007-08-01 09:21:17 UTC
Zdenek, do you have the access to a ppc64 machine to work on the bootstrap problem?  Can I provide an useful assistance?

-- Victor
Comment 23 rakdver@kam.mff.cuni.cz 2007-08-01 09:55:53 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> Zdenek, do you have the access to a ppc64 machine to work on the bootstrap
> problem?

I do; however, I got stuck with another bootstrap problem at the moment
(vectorization changes alignment of variables, which causes a
misscompilation of crtend.o on my machine; once I fix that, I should
hopefully be able to reproduce the problem described in this PR.
Comment 24 dorit 2007-08-01 10:08:44 UTC
> I do; however, I got stuck with another bootstrap problem at the moment
> (vectorization changes alignment of variables, which causes a
> misscompilation of crtend.o on my machine; 

I wonder if this is related to PR32893?
Comment 25 Victor Kaplansky 2007-08-13 06:42:51 UTC
Yesterday, I've tried to check if mainline passes boostrap with vectorization enabled on ppc32 using latest mainline.  Since I don't have the access to ppc32 machine, I've tried to imitate in on ppc64 using the following config:

../gcc/configure --build=powerpc-suse-linux --with-cpu=default32 --prefix=/home/victork/mainline/usr.trunk.127373 --enable-languages=c,c++,fortran

Unfortuantely, this bootstrap failed as shown below:

.....
/home/victork/mainline/build.trunk.127373/./gcc/xgcc -B/home/victork/mainline/build.trunk.127373/./gcc/ -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/bin/ -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/lib/ -isystem /home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/include -isystem /home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/sys-include -g -O2 -ftree-vectorize -maltivec -msoft-float -fPIC -mstrict-align -O2  -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -mlong-double-128 -I. -I. -I../../.././gcc -I../../../../gcc/libgcc -I../../../../gcc/libgcc/. -I../../../../gcc/libgcc/../gcc -I../../../../gcc/libgcc/../include -I../../../../gcc/libgcc/../libdecnumber/dpd -I../../../../gcc/libgcc/../libdecnumber -I../../../libdecnumber -DHAVE_CC_TLS -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c ../../../../gcc/libgcc/../gcc/libgcc2.c \
          -fvisibility=hidden -DHIDE_EXPORTS
../../../../gcc/libgcc/../gcc/libgcc2.c: In function '__negdi2':
../../../../gcc/libgcc/../gcc/libgcc2.c:80: internal compiler error: in push_reload, at reload.c:1288
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
make[5]: *** [_negdi2.o] Error 1
make[5]: *** Waiting for unfinished jobs....


Zdenek, David, did you try to test bootstrap with vectoriaztion enabled recently? Can you give me an access to ppc32 to try my hand at it?
Comment 26 rakdver@kam.mff.cuni.cz 2007-08-13 11:31:55 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> Yesterday, I've tried to check if mainline passes boostrap with vectorization
> enabled on ppc32 using latest mainline.  Since I don't have the access to ppc32
> machine, I've tried to imitate in on ppc64 using the following config:
> 
> ../gcc/configure --build=powerpc-suse-linux --with-cpu=default32
> --prefix=/home/victork/mainline/usr.trunk.127373
> --enable-languages=c,c++,fortran
> 
> Unfortuantely, this bootstrap failed as shown below:
> 
> .....
> /home/victork/mainline/build.trunk.127373/./gcc/xgcc
> -B/home/victork/mainline/build.trunk.127373/./gcc/
> -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/bin/
> -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/lib/ -isystem
> /home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/include -isystem
> /home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/sys-include -g -O2
> -ftree-vectorize -maltivec -msoft-float -fPIC -mstrict-align -O2  -O2 -g -O2 
> -DIN_GCC    -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
> -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT
> -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED  -mlong-double-128 -I. -I.
> -I../../.././gcc -I../../../../gcc/libgcc -I../../../../gcc/libgcc/.
> -I../../../../gcc/libgcc/../gcc -I../../../../gcc/libgcc/../include
> -I../../../../gcc/libgcc/../libdecnumber/dpd
> -I../../../../gcc/libgcc/../libdecnumber -I../../../libdecnumber -DHAVE_CC_TLS
> -o _ashldi3.o -MT _ashldi3.o -MD -MP -MF _ashldi3.dep -DL_ashldi3 -c
> ../../../../gcc/libgcc/../gcc/libgcc2.c \
>           -fvisibility=hidden -DHIDE_EXPORTS
> ../../../../gcc/libgcc/../gcc/libgcc2.c: In function '__negdi2':
> ../../../../gcc/libgcc/../gcc/libgcc2.c:80: internal compiler error: in
> push_reload, at reload.c:1288
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> make[5]: *** [_negdi2.o] Error 1
> make[5]: *** Waiting for unfinished jobs....
> 
> 
> Zdenek, David, did you try to test bootstrap with vectoriaztion enabled
> recently?

this is the problem we discussed in this thread before; for now, add
-mabi=altivec to BOOT_CFLAGS to workaround it.
Comment 27 Victor Kaplansky 2007-08-13 15:09:23 UTC
> this is the problem we discussed in this thread before; for now, add
> -mabi=altivec to BOOT_CFLAGS to workaround it.

yes, this helped. Still I see a failure in cofigure before stage3 starts:
checking for powerpc-suse-linux-gcc...  /home/victork/mainline/build.trunk.127373/./prev-gcc/xgcc -B/home/victork/mainline/build.trunk.127373/./prev-gcc/ -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/bin/
checking for C compiler default output file name... a.out
checking whether the C compiler works... configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details.

Seemingly, the compiler created by stage 2 is unusable.  I'm not sure if it was originally a good idea to try to bootstrap ppc32 compiler on ppc64 machine.  Do you think it is feasible? What should be configuration and bootstrap make flags?
Comment 28 David Edelsohn 2007-08-13 15:17:49 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 

	Most everyone else bootstraps GCC on PPC64 with
--with-cpu=default32.  Are you missing some packages on SUSE?  This really
isn't a GCC bug any more, it is some problem with the way that you are
configuring and building GCC on your system.
Comment 29 rakdver@kam.mff.cuni.cz 2007-08-13 18:04:59 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> ------- Comment #27 from victork at il dot ibm dot com  2007-08-13 15:09 -------
> > this is the problem we discussed in this thread before; for now, add
> > -mabi=altivec to BOOT_CFLAGS to workaround it.
> 
> yes, this helped. Still I see a failure in cofigure before stage3 starts:
> checking for powerpc-suse-linux-gcc... 
> /home/victork/mainline/build.trunk.127373/./prev-gcc/xgcc
> -B/home/victork/mainline/build.trunk.127373/./prev-gcc/
> -B/home/victork/mainline/usr.trunk.127373/powerpc-suse-linux/bin/
> checking for C compiler default output file name... a.out
> checking whether the C compiler works... configure: error: cannot run C
> compiled programs.
> If you meant to cross compile, use `--host'.
> See `config.log' for more details.
> 
> Seemingly, the compiler created by stage 2 is unusable.

this is a misscompilation of crtbegin.o that I have been investigating
as well.  The reason seems to be that with -ftree-vectorize, we
change alignment of __CTOR_LIST__ and __DTOR_LIST__, although why
exactly this causes problems I did not find out yet.
Comment 30 Zdenek Dvorak 2007-08-13 18:06:47 UTC
(In reply to comment #28)
> Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC 
> 
>         Most everyone else bootstraps GCC on PPC64 with
> --with-cpu=default32.  Are you missing some packages on SUSE?  This really
> isn't a GCC bug any more, it is some problem with the way that you are
> configuring and building GCC on your system.

This is a GCC bug. The reason why it was not noticed before is that nobody bootstraps with vectorization enabled.
Comment 31 Victor Kaplansky 2007-08-14 05:53:25 UTC
>         Most everyone else bootstraps GCC on PPC64 with
> --with-cpu=default32.  Are you missing some packages on SUSE?  This really
> isn't a GCC bug any more, it is some problem with the way that you are
> configuring and building GCC on your system.

I think that my system is OK, since I am able to bootstrap with --with-cpu=default32 without vectorization.

> this is a misscompilation of crtbegin.o that I have been investigating
> as well.  The reason seems to be that with -ftree-vectorize, we
> change alignment of __CTOR_LIST__ and __DTOR_LIST__, although why
> exactly this causes problems I did not find out yet.

Maybe it is somehow related to PR32893 ?


Comment 32 victork 2007-10-09 06:55:23 UTC
Zdenek, do you need an access to PPC, in order to look into this?
Comment 33 rakdver@kam.mff.cuni.cz 2007-10-09 12:48:27 UTC
Subject: Re:  Bootstrap with vectorization enabled fails with ICE on PPC

> Zdenek, do you need an access to PPC, in order to look into this?

I was finally able to get access to the machine I left back at home;
I will have a look at the problem sometime this week.
Comment 34 Zdenek Dvorak 2007-10-13 20:40:30 UTC
Does this still reproduce for you?  After workarounding the crtstuff.c misscompilation as described in http://gcc.gnu.org/ml/gcc-patches/2007-10/msg00743.html, bootstrap with BOOT_CFLAGS="-O2 -ftree-vectorize -maltivec" passes for me on ppc64-linux.
Comment 35 dorit 2007-10-15 05:52:01 UTC
bootstrap with vectorization enabled with your patch applied passes for me on ppc64-linux. thanks!!
Comment 36 victork 2007-11-13 13:53:45 UTC
Subject: Bug 32582

Author: victork
Date: Tue Nov 13 13:53:33 2007
New Revision: 130138

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=130138
Log:
2007-11-13  Victor Kaplansky  <victork@il.ibm.com>

        PR tree-optimization/32582
        * Makefile.in (CRTSTUFF_CFLAGS): Add -fno-tree-vectorize



Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in

Comment 37 victork 2007-11-14 12:22:40 UTC
Fixed in revision 130138.