public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug bootstrap/40105]  New: [4.3/4.4 Regression] SH: segfault when recompiling itself
@ 2009-05-11 17:55 armin76 at gentoo dot org
  2009-05-12  0:45 ` [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system kkojima at gcc dot gnu dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: armin76 at gentoo dot org @ 2009-05-11 17:55 UTC (permalink / raw)
  To: gcc-bugs

Since gcc-4.3 I'm unable to rebuild gcc, please check the downstream bug:
http://bugs.gentoo.org/show_bug.cgi?id=267247

As pointed out there, it compiles with gcc-4.1.2, but after upgrading to
gcc-4.3, switching to that compiler, and recompiling itself, it segfaults.

sh4-unknown-linux-gnu-gcc   -O -DIN_GCC   -W -Wall -Wwrite-strings
-Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros       
                          -Wno-overlength-strings -fno-common   -DHAVE_CONFIG_H
-Wl,-O1 -o xgcc gcc.o opts-common.o gcc-options.o gccspec.o \
          intl.o prefix.o version.o  ../libcpp/libcpp.a  
../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
/var/tmp/portage/sys-devel/gcc-4.3.3-r2/work/build/./gcc/xgcc
-B/var/tmp/portage/sys-devel/gcc-4.3.3-r2/work/build/./gcc/
-B/usr/sh4-unknown-linux-gnu/bin/ -B/usr/sh4-unknown-linux-gnu/lib/ -isystem
/usr/sh4-unknown-linux-gnu/include -isystem
/usr/sh4-unknown-linux-gnu/sys-include -dumpspecs > tmp-specs
/bin/sh: line 1:  9859 Segmentation fault     
/var/tmp/portage/sys-devel/gcc-4.3.3-r2/work/build/./gcc/xgcc
-B/var/tmp/portage/sys-devel/gcc-4.3.3-r2/work/build/./gcc/
-B/usr/sh4-unknown-linux-gnu/bin/ -B/usr/sh4-unknown-linux-gnu/lib/ -isystem
/usr/sh4-unknown-linux-gnu/include -isystem
/usr/sh4-unknown-linux-gnu/sys-include -dumpspecs > tmp-specs
make[3]: *** [specs] Error 139
make[3]: Leaving directory

Let me know if you need more info


-- 
           Summary: [4.3/4.4 Regression] SH: segfault when recompiling
                    itself
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: bootstrap
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: armin76 at gentoo dot org
 GCC build triplet: sh4-unknown-linux-gnu
  GCC host triplet: sh4-unknown-linux-gnu
GCC target triplet: sh4-unknown-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
@ 2009-05-12  0:45 ` kkojima at gcc dot gnu dot org
  2009-05-12 17:27 ` armin76 at gentoo dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-12  0:45 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from kkojima at gcc dot gnu dot org  2009-05-12 00:43 -------
Your compilers are the gentoo special versions, aren't they?
If so, you should try the original FSF compiler sources for both
build/target compilers.  See http://gcc.gnu.org/bugs.html#dontwant.
FSF 4.3/4.4 release compilers are bootstraped without problems
on sh4-unknown-linux-gnu for me. 
Only I can say from the log in #1 is that your xgcc driver looks
to segfault with -dumpspecs option.  Since it doesn't happen with
your gcc-4.1.2, it seems that your 4.3 compiler miscompiles something
for xgcc.  If it's the case, you can bisect the problem with
replacing objects and libraries for xgcc with those compiled by
your 4.1.2 compiler.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
           Priority|P3                          |P4
            Summary|[4.3/4.4 Regression] SH:    |SH: 4.3/4.4 compilers
                   |segfault when recompiling   |segfault when recompiling
                   |itself                      |itself on gentoo system


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
  2009-05-12  0:45 ` [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system kkojima at gcc dot gnu dot org
@ 2009-05-12 17:27 ` armin76 at gentoo dot org
  2009-05-12 22:38 ` [Bug target/40105] " kkojima at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: armin76 at gentoo dot org @ 2009-05-12 17:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from armin76 at gentoo dot org  2009-05-12 17:27 -------
(In reply to comment #1)
> Your compilers are the gentoo special versions, aren't they?
Nope, there's no patch applied in this case. If you meant that we don't 'make
bootstrap-lean && make install', yes.

> If so, you should try the original FSF compiler sources for both
> build/target compilers.  See http://gcc.gnu.org/bugs.html#dontwant.
> FSF 4.3/4.4 release compilers are bootstraped without problems
> on sh4-unknown-linux-gnu for me. 
> Only I can say from the log in #1 is that your xgcc driver looks
> to segfault with -dumpspecs option.  Since it doesn't happen with
> your gcc-4.1.2, it seems that your 4.3 compiler miscompiles something
> for xgcc.  If it's the case, you can bisect the problem with
> replacing objects and libraries for xgcc with those compiled by
> your 4.1.2 compiler.
> 

Can you build gcc-4.3.3 using gcc-4.3.3 and with the following command?
make -j3 LDFLAGS=-Wl,-O1 STAGE1_CFLAGS=-O 'BOOT_CFLAGS= -O2 -pipe'
bootstrap-lean

Not sure if you saw what i said on #4.

Anyway, i'll try a more "cleaner" way, but in that case this bug can't be here.
Can you try with the command i pasted?

Thanks


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
  2009-05-12  0:45 ` [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system kkojima at gcc dot gnu dot org
  2009-05-12 17:27 ` armin76 at gentoo dot org
@ 2009-05-12 22:38 ` kkojima at gcc dot gnu dot org
  2009-05-13 14:07 ` kkojima at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-12 22:38 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from kkojima at gcc dot gnu dot org  2009-05-12 22:37 -------
Ah, now I understand the issue and find that what we need
in the bug report http://gcc.gnu.org/bugs.html#need is in
http://bugs.gentoo.org/show_bug.cgi?id=267247.  Next time,
please give the minimal information to reproduce the problem
in the bug report itself, not in some URL.
The real problem will be the wrong code problem with -O1
for 4.3 compiler on SH, rather than a bootstrap problem.  It
might be very hard to solve, though.  Perhaps we can find what
part of the compiler is miscompiled with the 4.3 compiler
with -O by replacing gcc/*.o objects compiled with -O2.
Even if we can detect a problematic .o, it will be very
large and it'd be difficult to get an appropriate test case
which is wrongly compiled with -O.  We can't go forward
without such a test case.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
          Component|bootstrap                   |target
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-05-12 22:37:54
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (2 preceding siblings ...)
  2009-05-12 22:38 ` [Bug target/40105] " kkojima at gcc dot gnu dot org
@ 2009-05-13 14:07 ` kkojima at gcc dot gnu dot org
  2009-05-14  0:12 ` kkojima at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-13 14:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from kkojima at gcc dot gnu dot org  2009-05-13 14:07 -------
Created an attachment (id=17857)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17857&action=view)
a test case

I've got a small test case from libiberty/concat.c.
With -O1, 4.3 compiles vconcat_length to the codes below:

        ...
.L5:
        jsr     @r12            ! Call strlen
        nop
        add     r0,r9
        mov.l   @r8,r4
        mov     r4,r2
        add     #4,r2
        mov.l   @(4,r8),r1
        cmp/hs  r2,r1
        bt/s    .L4
        mov     r8,r2
        mov.l   @(16,r8),r4
        mov     r13,r2
.L4:
        mov     r4,r1
        add     #4,r1
        mov.l   r1,@r2
        mov.l   @r4,r4
        tst     r4,r4
        bf/s    .L5
        mov     r9,r4           !!!
        mov.l   .L17,r0
        jsr     @r0             ! Call malloc.
        ...

i.e. the delayed branch optimization fills a delay slot
with an inappropriate instruction at the line !!!.
I've confirmed that the 4.4 compiler's output is similar
and the outputs for 4.2 and 4.5 look correct even with -O.
I have no idea for what is going on ATM, though.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (3 preceding siblings ...)
  2009-05-13 14:07 ` kkojima at gcc dot gnu dot org
@ 2009-05-14  0:12 ` kkojima at gcc dot gnu dot org
  2009-05-18 16:29 ` armin76 at gentoo dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-14  0:12 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from kkojima at gcc dot gnu dot org  2009-05-14 00:12 -------
Created an attachment (id=17860)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17860&action=view)
A patch

A binary search on trunk shows me that the patch in r146829 and
its follow-up r146988 fix the issue.
See http://gcc.gnu.org/ml/gcc-patches/2009-04/msg02097.html for
r146829 changes.
With these patches, 4.3 compiler emits "bf .L5" instead of "bf/s .L5"
even with -O1.  So it seems that this is an rtl-optimization issue
which is fixed on trunk recently.
I'm not sure about the backport to the release branches because
that patch is originally for PR 34415 which was also a mips 4.3
regression and solved only on the trunk (4.4 at that moment).
I've attached an r146829+r146988 patch tuned for gcc-4_3-branch.
Could you try it?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug target/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (4 preceding siblings ...)
  2009-05-14  0:12 ` kkojima at gcc dot gnu dot org
@ 2009-05-18 16:29 ` armin76 at gentoo dot org
  2009-05-18 23:42 ` [Bug rtl-optimization/40105] [4.3/4.4 Regression] " kkojima at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: armin76 at gentoo dot org @ 2009-05-18 16:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from armin76 at gentoo dot org  2009-05-18 16:29 -------
Sorry for taking a while, but i'm pretty sure you know sh machines are kinda of
slow :)

Yes! it works!

Thank you for investigating it


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/40105] [4.3/4.4 Regression] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (5 preceding siblings ...)
  2009-05-18 16:29 ` armin76 at gentoo dot org
@ 2009-05-18 23:42 ` kkojima at gcc dot gnu dot org
  2009-05-21 23:18 ` kkojima at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-18 23:42 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from kkojima at gcc dot gnu dot org  2009-05-18 23:41 -------
Thanks for confirmation!  I'll ask if the r146829 patch is safe
to backport for 4.[34] branches in the gcc list, after the tests
on x86 and powerpc.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization
           Keywords|                            |wrong-code
      Known to work|4.1.2                       |4.1.2 4.5.0
            Summary|SH: 4.3/4.4 compilers       |[4.3/4.4 Regression] SH:
                   |segfault when recompiling   |4.3/4.4 compilers segfault
                   |itself on gentoo system     |when recompiling itself on
                   |                            |gentoo system


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/40105] [4.3/4.4 Regression] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (6 preceding siblings ...)
  2009-05-18 23:42 ` [Bug rtl-optimization/40105] [4.3/4.4 Regression] " kkojima at gcc dot gnu dot org
@ 2009-05-21 23:18 ` kkojima at gcc dot gnu dot org
  2009-05-21 23:32 ` kkojima at gcc dot gnu dot org
  2009-05-21 23:36 ` kkojima at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-21 23:18 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from kkojima at gcc dot gnu dot org  2009-05-21 23:17 -------
Subject: Bug 40105

Author: kkojima
Date: Thu May 21 23:17:37 2009
New Revision: 147780

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147780
Log:
        PR rtl-optimization/40105
        Backport from mainline:

        2009-04-29  Eric Botcazou  <ebotcazou@adacore.com>
                    Steven Bosscher  <steven@gcc.gnu.org>

        * Makefile.in (cfgrtl.o): Add $(INSN_ATTR_H).
        * cfgrtl.c: Include insn-attr.h.
        (rest_of_pass_free_cfg): New function.
        (pass_free_cfg): Use rest_of_pass_free_cfg as execute function.

        2009-04-27  Richard Sandiford  <rdsandiford@googlemail.com>
                    Eric Botcazou  <ebotcazou@adacore.com>

        * resource.c (find_basic_block): Use BLOCK_FOR_INSN to look up
        a label's basic block.
        (mark_target_live_regs): Tidy and rework obsolete comments.
        Change back DF problem to LIVE.  If a label starts a basic block,
        assume that all registers that used to be live then still are.
        (init_resource_info): If a label starts a basic block, set its
        BLOCK_FOR_INSN accordingly.
        (free_resource_info): Undo the setting of BLOCK_FOR_INSN.


Modified:
    branches/gcc-4_4-branch/gcc/ChangeLog
    branches/gcc-4_4-branch/gcc/Makefile.in
    branches/gcc-4_4-branch/gcc/cfgrtl.c
    branches/gcc-4_4-branch/gcc/resource.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/40105] [4.3/4.4 Regression] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (7 preceding siblings ...)
  2009-05-21 23:18 ` kkojima at gcc dot gnu dot org
@ 2009-05-21 23:32 ` kkojima at gcc dot gnu dot org
  2009-05-21 23:36 ` kkojima at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-21 23:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #9 from kkojima at gcc dot gnu dot org  2009-05-21 23:31 -------
Subject: Bug 40105

Author: kkojima
Date: Thu May 21 23:31:44 2009
New Revision: 147781

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=147781
Log:
        PR rtl-optimization/40105
        Backport from mainline:

        2009-04-29  Eric Botcazou  <ebotcazou@adacore.com>
                    Steven Bosscher  <steven@gcc.gnu.org>

        * Makefile.in (cfgrtl.o): Add $(INSN_ATTR_H).
        * cfgrtl.c: Include insn-attr.h.
        (rest_of_pass_free_cfg): New function.
        (pass_free_cfg): Use rest_of_pass_free_cfg as execute function.

        2009-04-27  Richard Sandiford  <rdsandiford@googlemail.com>
                    Eric Botcazou  <ebotcazou@adacore.com>

        * resource.c (find_basic_block): Use BLOCK_FOR_INSN to look up
        a label's basic block.
        (mark_target_live_regs): Tidy and rework obsolete comments.
        Change back DF problem to LIVE.  If a label starts a basic block,
        assume that all registers that used to be live then still are.
        (init_resource_info): If a label starts a basic block, set its
        BLOCK_FOR_INSN accordingly.
        (free_resource_info): Undo the setting of BLOCK_FOR_INSN.


Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/Makefile.in
    branches/gcc-4_3-branch/gcc/cfgrtl.c
    branches/gcc-4_3-branch/gcc/resource.c


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Bug rtl-optimization/40105] [4.3/4.4 Regression] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system
  2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
                   ` (8 preceding siblings ...)
  2009-05-21 23:32 ` kkojima at gcc dot gnu dot org
@ 2009-05-21 23:36 ` kkojima at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: kkojima at gcc dot gnu dot org @ 2009-05-21 23:36 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #10 from kkojima at gcc dot gnu dot org  2009-05-21 23:36 -------
Fixed.


-- 

kkojima at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40105


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-05-21 23:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-11 17:55 [Bug bootstrap/40105] New: [4.3/4.4 Regression] SH: segfault when recompiling itself armin76 at gentoo dot org
2009-05-12  0:45 ` [Bug bootstrap/40105] SH: 4.3/4.4 compilers segfault when recompiling itself on gentoo system kkojima at gcc dot gnu dot org
2009-05-12 17:27 ` armin76 at gentoo dot org
2009-05-12 22:38 ` [Bug target/40105] " kkojima at gcc dot gnu dot org
2009-05-13 14:07 ` kkojima at gcc dot gnu dot org
2009-05-14  0:12 ` kkojima at gcc dot gnu dot org
2009-05-18 16:29 ` armin76 at gentoo dot org
2009-05-18 23:42 ` [Bug rtl-optimization/40105] [4.3/4.4 Regression] " kkojima at gcc dot gnu dot org
2009-05-21 23:18 ` kkojima at gcc dot gnu dot org
2009-05-21 23:32 ` kkojima at gcc dot gnu dot org
2009-05-21 23:36 ` kkojima at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).