public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
@ 2015-05-07  9:14 ` hef-cdt@rt-labs.com
  2015-05-07  9:29 ` hef-cdt@rt-labs.com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: hef-cdt@rt-labs.com @ 2015-05-07  9:14 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

Hans-Erik Floryd <hef-cdt@rt-labs.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hef-cdt@rt-labs.com

--- Comment #1 from Hans-Erik Floryd <hef-cdt@rt-labs.com> ---
I am seeing a similar problem compiling ip_addr.c from the lwIP project. The
segfault happens with GCC >= 4.8. GCC4.7.4 works fine. Using GCC4.9.2:

vmadm@ubuntu$ /home/vmadm/buildcross/toolchain//bfin-elf/bin/bfin-elf-gcc -c
ip_addr.i -Os -v
Using built-in specs.
COLLECT_GCC=/home/vmadm/buildcross/toolchain//bfin-elf/bin/bfin-elf-gcc
Target: bfin-elf
Configured with: ../gcc-4.9.2/configure --target=bfin-elf
--prefix=/home/vmadm/buildcross/toolchain/bfin-elf --disable-nls --with-gnu-as
--with-gnu-ld --enable-languages=c,c++ --enable-plugins --with-newlib
--with-headers=../newlib-2.2.0.20150323/newlib/libc/include --disable-shared
--disable-threads --disable-libssp --disable-libmudflap --disable-libgomp
--disable-__cxa_atexit --disable-libstdcxx-pch --disable-multilib
Thread model: single
gcc version 4.9.2 
COLLECT_GCC_OPTIONS='-c' '-Os' '-v'
 /home/vmadm/buildcross/toolchain/bfin-elf/libexec/gcc/bfin-elf/4.9.2/cc1
-fpreprocessed ip_addr.i -fshort-wchar -quiet -dumpbase ip_addr.i -auxbase
ip_addr -Os -version -o /tmp/ccl40owG.s
GNU C version 4.9.2 (bfin-elf)
        compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C version 4.9.2 (bfin-elf)
        compiled by GNU C version 4.8.2, GMP version 4.3.2, MPFR version 2.4.2,
MPC version 0.8.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: ccc6db3091b1c65b1a52924f93fd549a
ip_addr.c: In function 'ipaddr_ntoa_r':
ip_addr.c:312:1: internal compiler error: Segmentation fault
 }
 ^
0x8490960 crash_signal
        ../../gcc-4.9.2/gcc/toplev.c:337
0x82c6a01 insn_current_reference_address(rtx_def*)
        ../../gcc-4.9.2/gcc/final.c:656
0x867c44b insn_current_length(rtx_def*)
        /home/vmadm/buildcross/build/build_gcc/gcc/insn-attrtab.c:35
0x82c75d8 shorten_branches(rtx_def*)
        ../../gcc-4.9.2/gcc/final.c:1446
0x82c7a1f rest_of_handle_shorten_branches
        ../../gcc-4.9.2/gcc/final.c:4519
0x82c7a1f execute
        ../../gcc-4.9.2/gcc/final.c:4548
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.

The segfault only happens when using -Os.


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

* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
  2015-05-07  9:14 ` [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel hef-cdt@rt-labs.com
@ 2015-05-07  9:29 ` hef-cdt@rt-labs.com
  2015-06-20  8:42 ` gang.chen.5i5j at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: hef-cdt@rt-labs.com @ 2015-05-07  9:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

--- Comment #2 from Hans-Erik Floryd <hef-cdt@rt-labs.com> ---
Created attachment 35484
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35484&action=edit
Simplified version of file causing segfault


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

* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
  2015-05-07  9:14 ` [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel hef-cdt@rt-labs.com
  2015-05-07  9:29 ` hef-cdt@rt-labs.com
@ 2015-06-20  8:42 ` gang.chen.5i5j at gmail dot com
  2015-06-20 10:26 ` gang.chen.5i5j at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-20  8:42 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

--- Comment #3 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
It is about JUMP_LABEL, gcc should set the JUMP_LABEL before use it. If we set
the label as soon as it is generated, it can build the issue code successfully.


diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index dc24ed5..b8c9567 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3777,7 +3777,8 @@ hwloop_optimize (hwloop_info loop)
        }
       else
        {
-         emit_jump_insn (gen_jump (label));
+         rtx_insn * ret = emit_jump_insn (gen_jump (label));
+         JUMP_LABEL(ret) = label;
          seq_end = emit_barrier ();
        }
     }

So we can say, it must be the direct cause (but may be not the root cause). I
shall continue analyzing: "why gcc did not set JUMP_LABEL before using it".

Welcome any others' ideas, suggestions and completions.

Thanks.


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

* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2015-06-20  8:42 ` gang.chen.5i5j at gmail dot com
@ 2015-06-20 10:26 ` gang.chen.5i5j at gmail dot com
  2015-06-24  4:23 ` law at gcc dot gnu.org
  2015-06-24  4:29 ` law at redhat dot com
  5 siblings, 0 replies; 6+ messages in thread
From: gang.chen.5i5j at gmail dot com @ 2015-06-20 10:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

--- Comment #4 from Chen Gang <gang.chen.5i5j at gmail dot com> ---
Reference to gccint.pdf Page 268 for jump_isn, we know that JUMP_LABLE() must
be defined after optimization completed. In our case, we are just doing
optimization, and is almost finished, so we need set JUMP_LABLE() after emit
jump_insn.

The related diff is bellow:

diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index dc24ed5..0297b59 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -3777,7 +3777,10 @@ hwloop_optimize (hwloop_info loop)
        }
       else
        {
-         emit_jump_insn (gen_jump (label));
+         rtx_insn * ret = emit_jump_insn (gen_jump (label));
+
+         JUMP_LABEL(ret) = label;
+         LABEL_NUSES (label)++;
          seq_end = emit_barrier ();
        }
     }


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

* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2015-06-20 10:26 ` gang.chen.5i5j at gmail dot com
@ 2015-06-24  4:23 ` law at gcc dot gnu.org
  2015-06-24  4:29 ` law at redhat dot com
  5 siblings, 0 replies; 6+ messages in thread
From: law at gcc dot gnu.org @ 2015-06-24  4:23 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

--- Comment #5 from Jeffrey A. Law <law at gcc dot gnu.org> ---
Author: law
Date: Wed Jun 24 04:22:39 2015
New Revision: 224866

URL: https://gcc.gnu.org/viewcvs?rev=224866&root=gcc&view=rev
Log:
        PR target/65803
        * config/bfin/bfin.c (hwloop_optimize): Initialize
        JUMP_LABEL for newly created jump.

        PR target/65803
        * gcc.c-torture/pr65803.c: New test.

Added:
    trunk/gcc/testsuite/gcc.c-torture/compile/pr65803.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config/bfin/bfin.c
    trunk/gcc/testsuite/ChangeLog


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

* [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel
       [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2015-06-24  4:23 ` law at gcc dot gnu.org
@ 2015-06-24  4:29 ` law at redhat dot com
  5 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2015-06-24  4:29 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65803

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |law at redhat dot com
         Resolution|---                         |FIXED

--- Comment #6 from Jeffrey A. Law <law at redhat dot com> ---
Fixed on trunk.


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

end of thread, other threads:[~2015-06-24  4:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-65803-4@http.gcc.gnu.org/bugzilla/>
2015-05-07  9:14 ` [Bug target/65803] blackfin: internal compiler error: segment fault linux kernel hef-cdt@rt-labs.com
2015-05-07  9:29 ` hef-cdt@rt-labs.com
2015-06-20  8:42 ` gang.chen.5i5j at gmail dot com
2015-06-20 10:26 ` gang.chen.5i5j at gmail dot com
2015-06-24  4:23 ` law at gcc dot gnu.org
2015-06-24  4:29 ` law at redhat dot com

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).