public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/112504] New: gcc: 14: internal compiler error: in operand_equal_p, at fold-const.cc:3313
@ 2023-11-13  3:33 141242068 at smail dot nju.edu.cn
  2023-11-13  6:16 ` [Bug c/112504] " pinskia at gcc dot gnu.org
  2023-11-13  6:30 ` [Bug c/112504] ICE " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: 141242068 at smail dot nju.edu.cn @ 2023-11-13  3:33 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112504
           Summary: gcc: 14: internal compiler error: in operand_equal_p,
                    at fold-const.cc:3313
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: 141242068 at smail dot nju.edu.cn
  Target Milestone: ---

Compiler Explorer: https://gcc.godbolt.org/z/YdETsKzeb

When compiling this program with `gcc-14 -O0`, gcc crashes:
```
struct s {
  char c[1];
};
extern struct s foo(void);
void bar(void) {
  foo().c == foo().c;
}
```

The crash output:
```
<source>: In function 'bar':
<source>:6:3: internal compiler error: in operand_equal_p, at
fold-const.cc:3313
    6 |   foo().c == foo().c;
      |   ^~~
0x238b15e internal_error(char const*, ...)
        ???:0
0xa11270 fancy_abort(char const*, int, char const*)
        ???:0
0xd0bd67 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
        ???:0
0xd0b6e4 operand_compare::operand_equal_p(tree_node const*, tree_node const*,
unsigned int)
        ???:0
0xd25837 fold_binary_loc(unsigned int, tree_code, tree_node*, tree_node*,
tree_node*)
        ???:0
0xd45c84 fold(tree_node*)
        ???:0
0xac0aef c_fully_fold(tree_node*, bool, bool*, bool)
        ???:0
0xa574e3 c_process_expr_stmt(unsigned int, tree_node*)
        ???:0
0xa57711 c_finish_expr_stmt(unsigned int, tree_node*)
        ???:0
0xabd40d c_parse_file()
        ???:0
0xb30909 c_common_parse_file()
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1
```

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

* [Bug c/112504] gcc: 14: internal compiler error: in operand_equal_p, at fold-const.cc:3313
  2023-11-13  3:33 [Bug c/112504] New: gcc: 14: internal compiler error: in operand_equal_p, at fold-const.cc:3313 141242068 at smail dot nju.edu.cn
@ 2023-11-13  6:16 ` pinskia at gcc dot gnu.org
  2023-11-13  6:30 ` [Bug c/112504] ICE " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-13  6:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
ICE checking because this checking is only enabled if checking is enabled:
3313            gcc_checking_assert (!(flags & OEP_ADDRESS_OF));

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

* [Bug c/112504] ICE in operand_equal_p, at fold-const.cc:3313
  2023-11-13  3:33 [Bug c/112504] New: gcc: 14: internal compiler error: in operand_equal_p, at fold-const.cc:3313 141242068 at smail dot nju.edu.cn
  2023-11-13  6:16 ` [Bug c/112504] " pinskia at gcc dot gnu.org
@ 2023-11-13  6:30 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-13  6:30 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-11-13
     Ever confirmed|0                           |1
           Keywords|                            |ice-on-valid-code
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
The C++ front-end fixes this by wrapping the call of foo with a TARGET_EXPR.

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

end of thread, other threads:[~2023-11-13  6:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-13  3:33 [Bug c/112504] New: gcc: 14: internal compiler error: in operand_equal_p, at fold-const.cc:3313 141242068 at smail dot nju.edu.cn
2023-11-13  6:16 ` [Bug c/112504] " pinskia at gcc dot gnu.org
2023-11-13  6:30 ` [Bug c/112504] ICE " pinskia 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).