public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3
@ 2020-04-16 15:03 ola.olsson at acconeer dot com
  2020-04-16 15:04 ` [Bug c/94621] " ola.olsson at acconeer dot com
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: ola.olsson at acconeer dot com @ 2020-04-16 15:03 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94621
           Summary: GCC 9.2.1 segfaults when compiling file with -O3
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ola.olsson at acconeer dot com
  Target Milestone: ---

Hi,
I compiled the c-file version of the attached file with:
$ gcc -v -save-temps -fsanitize=undefined  -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -Wall -Wextra -O3 -c segfault.c  > gcc_info
2>&1

The issue does not happen if I use -O0.

$ cat gcc_info 
Using built-in specs.
COLLECT_GCC=gcc
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.2.1-9ubuntu2'
--with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu
--enable-libstdcxx-debug --enable-libstdcxx-time=yes
--with-default-libstdcxx-abi=new --enable-gnu-unique-object
--disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib
--with-target-system-zlib=auto --enable-multiarch --disable-werror
--with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.2.1 20191008 (Ubuntu 9.2.1-9ubuntu2) 
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined'
'-fno-strict-aliasing' '-fwrapv' '-fno-aggressive-loop-optimizations' '-Wall'
'-Wextra' '-O3' '-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -E -quiet -v -imultiarch x86_64-linux-gnu
segfault.c -mtune=generic -march=x86-64 -Wall -Wextra -fsanitize=undefined
-fno-strict-aliasing -fwrapv -fno-aggressive-loop-optimizations -O3
-fpch-preprocess -fasynchronous-unwind-tables -fstack-protector-strong
-Wformat-security -fstack-clash-protection -fcf-protection -o segfault.i
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/9/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/9/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
COLLECT_GCC_OPTIONS='-v' '-save-temps' '-fsanitize=undefined'
'-fno-strict-aliasing' '-fwrapv' '-fno-aggressive-loop-optimizations' '-Wall'
'-Wextra' '-O3' '-c' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/9/cc1 -fpreprocessed segfault.i -quiet -dumpbase
segfault.c -mtune=generic -march=x86-64 -auxbase segfault -O3 -Wall -Wextra
-version -fsanitize=undefined -fno-strict-aliasing -fwrapv
-fno-aggressive-loop-optimizations -fasynchronous-unwind-tables
-fstack-protector-strong -Wformat-security -fstack-clash-protection
-fcf-protection -o segfault.s
GNU C17 (Ubuntu 9.2.1-9ubuntu2) version 9.2.1 20191008 (x86_64-linux-gnu)
        compiled by GNU C version 9.2.1 20191008, GMP version 6.1.2, MPFR
version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU C17 (Ubuntu 9.2.1-9ubuntu2) version 9.2.1 20191008 (x86_64-linux-gnu)
        compiled by GNU C version 9.2.1 20191008, GMP version 6.1.2, MPFR
version 4.0.2, MPC version 1.1.0, isl version isl-0.21-GMP

GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: dd54e5384b34908287640134d9f8a49c
during IPA pass: inline
segfault.c: In function ‘get_element’:
segfault.c:8:5: internal compiler error: Segmentation fault
    8 | int get_element(a_struct *m, int row, int col)
      |     ^~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.

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

* [Bug c/94621] GCC 9.2.1 segfaults when compiling file with -O3
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
@ 2020-04-16 15:04 ` ola.olsson at acconeer dot com
  2020-04-16 15:08 ` jakub at gcc dot gnu.org
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ola.olsson at acconeer dot com @ 2020-04-16 15:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Ola Olsson <ola.olsson at acconeer dot com> ---
Created attachment 48292
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48292&action=edit
Preprocessed file of the smallest example I could make

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

* [Bug c/94621] GCC 9.2.1 segfaults when compiling file with -O3
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
  2020-04-16 15:04 ` [Bug c/94621] " ola.olsson at acconeer dot com
@ 2020-04-16 15:08 ` jakub at gcc dot gnu.org
  2020-04-16 15:53 ` [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354 jakub at gcc dot gnu.org
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-16 15:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
*** Bug 94620 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
  2020-04-16 15:04 ` [Bug c/94621] " ola.olsson at acconeer dot com
  2020-04-16 15:08 ` jakub at gcc dot gnu.org
@ 2020-04-16 15:53 ` jakub at gcc dot gnu.org
  2020-04-16 16:31 ` jakub at gcc dot gnu.org
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-16 15:53 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
            Summary|GCC 9.2.1 segfaults when    |[9/10 Regression] GCC 9.2.1
                   |compiling file with -O3     |segfaults when compiling
                   |                            |file with -O3 since r9-5354
                 CC|                            |jakub at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org
          Component|c                           |tree-optimization
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2020-04-16
     Ever confirmed|0                           |1

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Started with my r9-5354-gda972c05f48637060ae3a3b121f99d1522413b82
Slightly cleaned up testcase at -O2:
struct S { int c, e[]; };

static inline int
foo (struct S *m, int r, int c)
{
  int (*a)[][m->c] = (int (*)[][m->c])&m->e;
  return (*a)[r][c];
}

void
bar (struct S *a)
{
  foo (a, 0, 0);
}

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (2 preceding siblings ...)
  2020-04-16 15:53 ` [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354 jakub at gcc dot gnu.org
@ 2020-04-16 16:31 ` jakub at gcc dot gnu.org
  2020-04-16 16:33 ` ola.olsson at acconeer dot com
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-16 16:31 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48294
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48294&action=edit
gcc10-pr94621.patch

Untested fix.

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (3 preceding siblings ...)
  2020-04-16 16:31 ` jakub at gcc dot gnu.org
@ 2020-04-16 16:33 ` ola.olsson at acconeer dot com
  2020-04-17  6:59 ` rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: ola.olsson at acconeer dot com @ 2020-04-16 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Ola Olsson <ola.olsson at acconeer dot com> ---
My god. Insanely fast. Dobra robota/prace!

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (4 preceding siblings ...)
  2020-04-16 16:33 ` ola.olsson at acconeer dot com
@ 2020-04-17  6:59 ` rguenth at gcc dot gnu.org
  2020-04-17  7:00 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-17  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Ola Olsson from comment #5)
> My god. Insanely fast. Dobra robota/prace!

The power of Free Software / Open Source.

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (5 preceding siblings ...)
  2020-04-17  6:59 ` rguenth at gcc dot gnu.org
@ 2020-04-17  7:00 ` rguenth at gcc dot gnu.org
  2020-04-17  7:24 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-17  7:00 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #4)
> Created attachment 48294 [details]
> gcc10-pr94621.patch
> 
> Untested fix.

LGTM (obvious even)

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

* [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (6 preceding siblings ...)
  2020-04-17  7:00 ` rguenth at gcc dot gnu.org
@ 2020-04-17  7:24 ` cvs-commit at gcc dot gnu.org
  2020-04-17  8:34 ` [Bug tree-optimization/94621] [9 " jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-17  7:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:c58cb6ac6891886b7aa01c440ac71a5e7cbcba97

commit r10-7768-gc58cb6ac6891886b7aa01c440ac71a5e7cbcba97
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 17 09:07:49 2020 +0200

    inliner: Don't ICE on NULL TYPE_DOMAIN [PR94621]

    When I've added the VLA tweak for OpenMP to avoid error_mark_nodes in the
IL in
    type, I forgot that TYPE_DOMAIN could be NULL.  Furthermore, as an
optimization,
    this patch checks the hopefully cheapest condition that is very likely
false
    most of the time (enabled only during OpenMP handling) first.

    2020-04-17  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/94621
            * tree-inline.c (remap_type_1): Don't dereference NULL TYPE_DOMAIN.
            Move id->adjust_array_error_bounds check first in the condition.

            * gcc.c-torture/compile/pr94621.c: New test.

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

* [Bug tree-optimization/94621] [9 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (7 preceding siblings ...)
  2020-04-17  7:24 ` cvs-commit at gcc dot gnu.org
@ 2020-04-17  8:34 ` jakub at gcc dot gnu.org
  2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
  2020-09-17 10:44 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-17  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[9/10 Regression] GCC 9.2.1 |[9 Regression] GCC 9.2.1
                   |segfaults when compiling    |segfaults when compiling
                   |file with -O3 since r9-5354 |file with -O3 since r9-5354

--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed on the trunk so far, queued for backporting to 9.

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

* [Bug tree-optimization/94621] [9 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (8 preceding siblings ...)
  2020-04-17  8:34 ` [Bug tree-optimization/94621] [9 " jakub at gcc dot gnu.org
@ 2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
  2020-09-17 10:44 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-16 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:5b23b0c44692cc5e4d5e726f96497bff73094e7b

commit r9-8880-g5b23b0c44692cc5e4d5e726f96497bff73094e7b
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Apr 17 09:07:49 2020 +0200

    inliner: Don't ICE on NULL TYPE_DOMAIN [PR94621]

    When I've added the VLA tweak for OpenMP to avoid error_mark_nodes in the
IL in
    type, I forgot that TYPE_DOMAIN could be NULL.  Furthermore, as an
optimization,
    this patch checks the hopefully cheapest condition that is very likely
false
    most of the time (enabled only during OpenMP handling) first.

    2020-04-17  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/94621
            * tree-inline.c (remap_type_1): Don't dereference NULL TYPE_DOMAIN.
            Move id->adjust_array_error_bounds check first in the condition.

            * gcc.c-torture/compile/pr94621.c: New test.

    (cherry picked from commit c58cb6ac6891886b7aa01c440ac71a5e7cbcba97)

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

* [Bug tree-optimization/94621] [9 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354
  2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
                   ` (9 preceding siblings ...)
  2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
@ 2020-09-17 10:44 ` jakub at gcc dot gnu.org
  10 siblings, 0 replies; 12+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-09-17 10:44 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #11 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed for 9.4+.

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

end of thread, other threads:[~2020-09-17 10:44 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 15:03 [Bug c/94621] New: GCC 9.2.1 segfaults when compiling file with -O3 ola.olsson at acconeer dot com
2020-04-16 15:04 ` [Bug c/94621] " ola.olsson at acconeer dot com
2020-04-16 15:08 ` jakub at gcc dot gnu.org
2020-04-16 15:53 ` [Bug tree-optimization/94621] [9/10 Regression] GCC 9.2.1 segfaults when compiling file with -O3 since r9-5354 jakub at gcc dot gnu.org
2020-04-16 16:31 ` jakub at gcc dot gnu.org
2020-04-16 16:33 ` ola.olsson at acconeer dot com
2020-04-17  6:59 ` rguenth at gcc dot gnu.org
2020-04-17  7:00 ` rguenth at gcc dot gnu.org
2020-04-17  7:24 ` cvs-commit at gcc dot gnu.org
2020-04-17  8:34 ` [Bug tree-optimization/94621] [9 " jakub at gcc dot gnu.org
2020-09-16 19:20 ` cvs-commit at gcc dot gnu.org
2020-09-17 10:44 ` jakub at gcc dot gnu.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).