public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552
@ 2021-05-10 19:34 cnsun at uwaterloo dot ca
  2021-05-10 21:15 ` [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: cnsun at uwaterloo dot ca @ 2021-05-10 19:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100509
           Summary: ICE at -O3: in fold_convert_loc, at fold-const.c:2552
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: cnsun at uwaterloo dot ca
  Target Milestone: ---

Not sure whether this is a dup of PR96131.

$ gcc-trunk -v
Using built-in specs.
COLLECT_GCC=gcc-trunk
COLLECT_LTO_WRAPPER=/scratch/software/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/12.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/tmp.FRQzt2wMfl-gcc-builder/gcc/configure
--enable-languages=c,c++,lto --enable-checking-yes --enable-multiarch
--prefix=/scratch/software/gcc-trunk --disable-bootstrap
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 12.0.0 20210510 (experimental) [master revision
:fb3a8fb4a:25f9f35a85ffee808fc1482b14d91176df59751b] (GCC)

$ cat mutant.c
struct X {
  int a;
};
const a = 0;
static struct X A __attribute__((alias("a")));
foo() { struct X b = A; }

$ gcc-trunk -O3 mutant.c
mutant.c:4:7: warning: type defaults to ‘int’ in declaration of ‘a’
[-Wimplicit-int]
    4 | const a = 0;
      |       ^
mutant.c:6:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    6 | foo() { struct X b = A; }
      | ^~~
during GIMPLE pass: forwprop
mutant.c: In function ‘foo’:
mutant.c:6:16: internal compiler error: in fold_convert_loc, at
fold-const.c:2552
    6 | foo() { struct X b = A; }
      |                ^
0x6bd7c1 fold_convert_loc(unsigned int, tree_node*, tree_node*)
        /tmp/tmp.FRQzt2wMfl-gcc-builder/gcc/gcc/fold-const.c:2552
0xc02486 fold_stmt_1
        /tmp/tmp.FRQzt2wMfl-gcc-builder/gcc/gcc/gimple-fold.c:6269
0x1032191 execute
        /tmp/tmp.FRQzt2wMfl-gcc-builder/gcc/gcc/tree-ssa-forwprop.c:3108
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
@ 2021-05-10 21:15 ` pinskia at gcc dot gnu.org
  2021-05-11  7:07 ` rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-05-10 21:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Chengnian Sun from comment #0)
> Not sure whether this is a dup of PR96131.

It is unrelated.

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

* [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
  2021-05-10 21:15 ` [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types pinskia at gcc dot gnu.org
@ 2021-05-11  7:07 ` rguenth at gcc dot gnu.org
  2021-05-11  8:09 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-11  7:07 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-05-11

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.  The code is border-line valid only, the alias ties objects
of incompatible type.  It goes wrong during fold_gimple_assign which eventually
calls get_symbol_constant_value.

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

* [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
  2021-05-10 21:15 ` [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types pinskia at gcc dot gnu.org
  2021-05-11  7:07 ` rguenth at gcc dot gnu.org
@ 2021-05-11  8:09 ` marxin at gcc dot gnu.org
  2021-05-11 10:48 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-05-11  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Started with r5-4443-g016adb0549c554d7.

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

* [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (2 preceding siblings ...)
  2021-05-11  8:09 ` marxin at gcc dot gnu.org
@ 2021-05-11 10:48 ` cvs-commit at gcc dot gnu.org
  2021-05-11 10:49 ` [Bug tree-optimization/100509] [9/10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-11 10:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

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

commit r12-712-gca8e8301180fa71de1a76769fc038df2ab85dfeb
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 10:58:35 2021 +0200

    middle-end/100509 - avoid folding constant to aggregate type

    When folding a constant initializer looking through aliases to
    incompatible types can lead to us trying to fold a constant
    to an aggregate type which can't work.  Simply avoid trying
    to constant fold non-register typed symbols.

    2021-05-11  Richard Biener  <rguenther@suse.de>

            PR middle-end/100509
            * gimple-fold.c (fold_gimple_assign): Only call
            get_symbol_constant_value on register type symbols.

            * gcc.dg/pr100509.c: New testcase.

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

* [Bug tree-optimization/100509] [9/10/11 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (3 preceding siblings ...)
  2021-05-11 10:48 ` cvs-commit at gcc dot gnu.org
@ 2021-05-11 10:49 ` rguenth at gcc dot gnu.org
  2021-05-25  8:07 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-05-11 10:49 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |9.4
            Summary|ICE at -O3: in              |[9/10/11 Regression] ICE at
                   |fold_convert_loc with       |-O3: in fold_convert_loc
                   |variable (attribute) alias  |with variable (attribute)
                   |of different types          |alias of different types
      Known to work|                            |12.0
           Priority|P3                          |P2

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/100509] [9/10/11 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (4 preceding siblings ...)
  2021-05-11 10:49 ` [Bug tree-optimization/100509] [9/10/11 Regression] " rguenth at gcc dot gnu.org
@ 2021-05-25  8:07 ` cvs-commit at gcc dot gnu.org
  2021-06-01  8:20 ` [Bug tree-optimization/100509] [9/10 " rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-25  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:3870fe246f442d795ef2270c74f56dda9d0be26c

commit r11-8463-g3870fe246f442d795ef2270c74f56dda9d0be26c
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 10:58:35 2021 +0200

    middle-end/100509 - avoid folding constant to aggregate type

    When folding a constant initializer looking through aliases to
    incompatible types can lead to us trying to fold a constant
    to an aggregate type which can't work.  Simply avoid trying
    to constant fold non-register typed symbols.

    2021-05-11  Richard Biener  <rguenther@suse.de>

            PR middle-end/100509
            * gimple-fold.c (fold_gimple_assign): Only call
            get_symbol_constant_value on register type symbols.

            * gcc.dg/pr100509.c: New testcase.

    (cherry picked from commit ca8e8301180fa71de1a76769fc038df2ab85dfeb)

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

* [Bug tree-optimization/100509] [9/10 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (5 preceding siblings ...)
  2021-05-25  8:07 ` cvs-commit at gcc dot gnu.org
@ 2021-06-01  8:20 ` rguenth at gcc dot gnu.org
  2021-06-16 14:24 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:20 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug tree-optimization/100509] [9/10 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (6 preceding siblings ...)
  2021-06-01  8:20 ` [Bug tree-optimization/100509] [9/10 " rguenth at gcc dot gnu.org
@ 2021-06-16 14:24 ` cvs-commit at gcc dot gnu.org
  2021-10-13 10:09 ` [Bug tree-optimization/100509] [9 " cvs-commit at gcc dot gnu.org
  2021-10-13 10:10 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-16 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

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

commit r10-9921-gcd712310edc2ffeec8982ba5f9aeaa0b14e93cf1
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 10:58:35 2021 +0200

    middle-end/100509 - avoid folding constant to aggregate type

    When folding a constant initializer looking through aliases to
    incompatible types can lead to us trying to fold a constant
    to an aggregate type which can't work.  Simply avoid trying
    to constant fold non-register typed symbols.

    2021-05-11  Richard Biener  <rguenther@suse.de>

            PR middle-end/100509
            * gimple-fold.c (fold_gimple_assign): Only call
            get_symbol_constant_value on register type symbols.

            * gcc.dg/pr100509.c: New testcase.

    (cherry picked from commit ca8e8301180fa71de1a76769fc038df2ab85dfeb)

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

* [Bug tree-optimization/100509] [9 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (7 preceding siblings ...)
  2021-06-16 14:24 ` cvs-commit at gcc dot gnu.org
@ 2021-10-13 10:09 ` cvs-commit at gcc dot gnu.org
  2021-10-13 10:10 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-10-13 10:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:379382c438652b594f0e91a61dbfce05eab080bd

commit r9-9768-g379382c438652b594f0e91a61dbfce05eab080bd
Author: Richard Biener <rguenther@suse.de>
Date:   Tue May 11 10:58:35 2021 +0200

    middle-end/100509 - avoid folding constant to aggregate type

    When folding a constant initializer looking through aliases to
    incompatible types can lead to us trying to fold a constant
    to an aggregate type which can't work.  Simply avoid trying
    to constant fold non-register typed symbols.

    2021-05-11  Richard Biener  <rguenther@suse.de>

            PR middle-end/100509
            * gimple-fold.c (fold_gimple_assign): Only call
            get_symbol_constant_value on register type symbols.

            * gcc.dg/pr100509.c: New testcase.

    (cherry picked from commit ca8e8301180fa71de1a76769fc038df2ab85dfeb)

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

* [Bug tree-optimization/100509] [9 Regression] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types
  2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
                   ` (8 preceding siblings ...)
  2021-10-13 10:09 ` [Bug tree-optimization/100509] [9 " cvs-commit at gcc dot gnu.org
@ 2021-10-13 10:10 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-10-13 10:10 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED
      Known to fail|                            |9.4.0

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-10-13 10:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 19:34 [Bug c/100509] New: ICE at -O3: in fold_convert_loc, at fold-const.c:2552 cnsun at uwaterloo dot ca
2021-05-10 21:15 ` [Bug tree-optimization/100509] ICE at -O3: in fold_convert_loc with variable (attribute) alias of different types pinskia at gcc dot gnu.org
2021-05-11  7:07 ` rguenth at gcc dot gnu.org
2021-05-11  8:09 ` marxin at gcc dot gnu.org
2021-05-11 10:48 ` cvs-commit at gcc dot gnu.org
2021-05-11 10:49 ` [Bug tree-optimization/100509] [9/10/11 Regression] " rguenth at gcc dot gnu.org
2021-05-25  8:07 ` cvs-commit at gcc dot gnu.org
2021-06-01  8:20 ` [Bug tree-optimization/100509] [9/10 " rguenth at gcc dot gnu.org
2021-06-16 14:24 ` cvs-commit at gcc dot gnu.org
2021-10-13 10:09 ` [Bug tree-optimization/100509] [9 " cvs-commit at gcc dot gnu.org
2021-10-13 10:10 ` rguenth 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).