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

Alex Potapenko <opotapenko at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |opotapenko at gmail dot com

--- Comment #27 from Alex Potapenko <opotapenko at gmail dot com> ---
I'd like to chime in to do two things: first suggest a (simple) way to
reproduce this using buildroot (GCC 7.2.0), and then post a gdb backtrace in
case there's something useful there (not sure how much different from Randy's
log it is).

1. Reproducing.
1.1) Download and unpack
https://buildroot.org/downloads/buildroot-2017.08.tar.bz2
1.2) Save
https://raw.githubusercontent.com/Optware/Optware-ng/5b3cbfeb2bb2444d47ea15bcce3081ffbaea8046/sources/buildroot-ppc-603e/config
as ".config" in buildroot root
1.3) Patch buildroot to make gcc debuggable:
diff --git a/package/gcc/gcc-final/gcc-final.mk
b/package/gcc/gcc-final/gcc-final.mk
index 213f3d7..4364e2a 100644
--- a/package/gcc/gcc-final/gcc-final.mk
+++ b/package/gcc/gcc-final/gcc-final.mk
@@ -41,6 +41,7 @@ define  HOST_GCC_FINAL_CONFIGURE_CMDS
        (cd $(HOST_GCC_FINAL_SRCDIR) && rm -rf config.cache; \
                $(HOST_CONFIGURE_OPTS) \
                CFLAGS="$(HOST_CFLAGS)" \
+               CXXFLAGS="-ggdb -O0" \
                LDFLAGS="$(HOST_LDFLAGS)" \
                $(HOST_GCC_FINAL_CONF_ENV) \
                ./configure \
@@ -107,6 +108,8 @@ HOST_GCC_FINAL_CONF_ENV = \

 HOST_GCC_FINAL_MAKE_OPTS += $(HOST_GCC_COMMON_MAKE_OPTS)

+HOST_GCC_FINAL_MAKE_OPTS += STAGE_CFLAGS="-ggdb -O0"
+
 # Make sure we have 'cc'
 define HOST_GCC_FINAL_CREATE_CC_SYMLINKS
        if [ ! -e $(HOST_DIR)/bin/$(GNU_TARGET_NAME)-cc ]; then \

1.4) Build the toolchain with `make`. You'll have the toolchain in
"buildroot-2017.08/output/host" after build is done

2. Now, gdb log from built toolchain (note that test.c is the "smaller
reproducer with manual work-around" uploaded by Randy):

jenkins@u0:~/buildroot-2017.08$ gdb
/home/jenkins/buildroot-2017.08/output/host/libexec/gcc/powerpc-buildroot-linux-gnu/7.2.0/cc1
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from
/home/jenkins/buildroot-2017.08/output/host/libexec/gcc/powerpc-buildroot-linux-gnu/7.2.0/cc1...done.
(gdb) run -quiet -v -imultilib . -imultiarch powerpc-linux-gnu -isysroot
/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot
-D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux
-Asystem=linux -Asystem=unix -Asystem=posix test.c -quiet -dumpbase test.c
-maltivec -mcpu=603e -auxbase test -version -o -
Starting program:
/home/jenkins/buildroot-2017.08/output/host/libexec/gcc/powerpc-buildroot-linux-gnu/7.2.0/cc1
-quiet -v -imultilib . -imultiarch powerpc-linux-gnu -isysroot
/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot
-D__unix__ -D__gnu_linux__ -D__linux__ -Dunix -D__unix -Dlinux -D__linux
-Asystem=linux -Asystem=unix -Asystem=posix test.c -quiet -dumpbase test.c
-maltivec -mcpu=603e -auxbase test -version -o -
GNU C11 (Buildroot 2017.08-g9362d96-dirty) version 7.2.0
(powerpc-buildroot-linux-gnu)
        compiled by GNU C version 5.4.0 20160609, GMP version 6.1.2, MPFR
version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory
"/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot/usr/local/include/powerpc-linux-gnu"
ignoring nonexistent directory
"/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot/usr/local/include"
ignoring nonexistent directory
"/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot/usr/include/powerpc-linux-gnu"
#include "..." search starts here:
#include <...> search starts here:

/home/jenkins/buildroot-2017.08/output/host/lib/gcc/powerpc-buildroot-linux-gnu/7.2.0/include

/home/jenkins/buildroot-2017.08/output/host/lib/gcc/powerpc-buildroot-linux-gnu/7.2.0/include-fixed

/home/jenkins/buildroot-2017.08/output/host/lib/gcc/powerpc-buildroot-linux-gnu/7.2.0/../../../../powerpc-buildroot-linux-gnu/include

/home/jenkins/buildroot-2017.08/output/host/powerpc-buildroot-linux-gnu/sysroot/usr/include
End of search list.
GNU C11 (Buildroot 2017.08-g9362d96-dirty) version 7.2.0
(powerpc-buildroot-linux-gnu)
        compiled by GNU C version 5.4.0 20160609, GMP version 6.1.2, MPFR
version 3.1.5, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 79638d26791d2fd1f2ddd744e299fa65
        .file   "test.c"
test.c:52:3: warning: unnamed struct/union that defines no instances
   };
   ^
test.c:55:11: warning: ‘struct random_data’ declared inside parameter list will
not be visible outside of this definition or declaration
    struct random_data *__restrict __buf)
           ^~~~~~~~~~~

Program received signal SIGSEGV, Segmentation fault.
0x00000000009df5fb in store_expr_with_bounds (exp=0x7ffff6943740,
target=0x7ffff6ac8fc0, call_param_p=0, nontemporal=false, reverse=false,
btarget=0x7ffff6942630) at ../../gcc/expr.c:5575
5575      if (CONSTANT_P (temp) && GET_MODE (temp) == VOIDmode
(gdb) bt full
#0  0x00000000009df5fb in store_expr_with_bounds (exp=0x7ffff6943740,
target=0x7ffff6ac8fc0, call_param_p=0, nontemporal=false, reverse=false,
btarget=0x7ffff6942630) at ../../gcc/expr.c:5575
        temp = 0x0
        alt_rtl = 0x0
        loc = 2147483665
        __FUNCTION__ = "store_expr_with_bounds"
#1  0x00000000009de7ee in expand_assignment (to=0x7ffff6942630,
from=0x7ffff6943740, nontemporal=false) at ../../gcc/expr.c:5321
        to_rtx = 0x7ffff6ac8fc0
        result = 0x0
        mode = V16QImode
        align = 4137801472
        icode = 4294957840
        __FUNCTION__ = "expand_assignment"
#2  0x00000000008a1b1b in expand_call_stmt (stmt=0x7ffff6ad45a0) at
../../gcc/cfgexpand.c:2656
        exp = 0x7ffff6943740
        decl = 0x7ffff6a1d700
        lhs = 0x7ffff6942630
        builtin_p = true
        i = 2
        __FUNCTION__ = "expand_call_stmt"
#3  0x00000000008a4645 in expand_gimple_stmt_1 (stmt=0x7ffff6ad45a0) at
../../gcc/cfgexpand.c:3571
        op0 = 0x7fffffffdcb0
        __FUNCTION__ = "expand_gimple_stmt_1"
#4  0x00000000008a4bfa in expand_gimple_stmt (stmt=0x7ffff6ad45a0) at
../../gcc/cfgexpand.c:3737
        saved_location = 566396
        last = 0x7ffff6ad8658
        lp_nr = 0
        __FUNCTION__ = "expand_gimple_stmt"
#5  0x00000000008aae3b in expand_gimple_basic_block (bb=0x7ffff6a9b270,
disable_tail_calls=false) at ../../gcc/cfgexpand.c:5744
        def_p = 0x7ffff6ad4608
        call_stmt = 0x7ffff6ad45a0
        new_bb = 0x0
        gsi = {ptr = 0x7ffff6ad45a0, seq = 0x7fffffffdd78, bb = 0x7ffff6a9b270}
        stmts = 0x7ffff6ad45a0
        stmt = 0x7ffff6ad45a0
        note = 0x7ffff6ad8658
        last = 0x7ffff6942e58
        e = 0x0
        ei = {index = 2, container = 0x7ffff6a9b210}
        __FUNCTION__ = "expand_gimple_basic_block"
        elt = 0x0
#6  0x00000000008ac3d5 in (anonymous namespace)::pass_expand::execute
(this=0x21fbba0, fun=0x7ffff6acd000) at ../../gcc/cfgexpand.c:6357
        bb = 0x7ffff6a9b270
        init_block = 0x7ffff6a9b548
        ei = {index = 1, container = 0x7ffff6a9b070}
        e = 0x0
        var_seq = 0x0
        var_ret_seq = 0x0
        i = 26
        name = 0x0
        __FUNCTION__ = "execute"
        blocks = {m_bitmap = 0x7fffffffdfb0}
#7  0x0000000000ca27e4 in execute_one_pass (pass=0x21fbba0) at
../../gcc/passes.c:2465
        todo_after = 0
        gate_status = true
        __FUNCTION__ = "execute_one_pass"
#8  0x0000000000ca2b47 in execute_pass_list_1 (pass=0x21fbba0) at
../../gcc/passes.c:2554
        __FUNCTION__ = "execute_pass_list_1"
#9  0x0000000000ca2bd0 in execute_pass_list (fn=0x7ffff6acd000, pass=0x21f8090)
at ../../gcc/passes.c:2565
        __FUNCTION__ = "execute_pass_list"
#10 0x00000000008ef168 in cgraph_node::expand (this=0x7ffff6ad7000) at
../../gcc/cgraphunit.c:2042
        saved_loc = 664512
        __FUNCTION__ = "expand"
#11 0x00000000008efa4f in output_in_order (no_reorder=false) at
../../gcc/cgraphunit.c:2285
        max = 2
        nodes = 0x21e8890
        i = 0
        pf = 0x0
        pv = 0x0
        pa = 0x0
        __FUNCTION__ = "output_in_order"
#12 0x00000000008f00ca in symbol_table::compile (this=0x7ffff693b000) at
../../gcc/cgraphunit.c:2529
No locals.
#13 0x00000000008f031b in symbol_table::finalize_compilation_unit
(this=0x7ffff693b000) at ../../gcc/cgraphunit.c:2625
No locals.
#14 0x0000000000dbd01c in compile_file () at ../../gcc/toplev.c:492
No locals.
#15 0x0000000000dbf670 in do_compile () at ../../gcc/toplev.c:2003
        i = 1
#16 0x0000000000dbf947 in toplev::main (this=0x7fffffffe230, argc=30,
argv=0x7fffffffe338) at ../../gcc/toplev.c:2137
        __FUNCTION__ = "main"
#17 0x0000000001611e37 in main (argc=30, argv=0x7fffffffe338) at
../../gcc/main.c:39
        toplev = {m_use_TV_TOTAL = true, m_init_signals = true}

Thanks. Hope this is useful,
Alex

Reply via email to