public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99198] New: when combinating nested function and __builtin_call_with_static_chain, optimization triggers an internal compiler error (verify_gimple)
@ 2021-02-22 12:50 zhan3299 at purdue dot edu
  2021-02-22 12:57 ` [Bug c/99198] " rguenth at gcc dot gnu.org
  2021-02-22 16:05 ` msebor at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: zhan3299 at purdue dot edu @ 2021-02-22 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99198
           Summary: when combinating nested function and
                    __builtin_call_with_static_chain, optimization
                    triggers an internal compiler error (verify_gimple)
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhan3299 at purdue dot edu
  Target Milestone: ---

Following code is reduced by c-reduce and meaningless, but seems valid as gcc
-O0 accept it. 

Under O0, the program can be successfully compiled
(https://godbolt.org/z/zvGxTP); but under O1, it triggers an internal compiler
error (https://godbolt.org/z/xbvrs6). Besides, any version prior version 11.0
has no such problem.

$ cat test.c
int main() {
    void f() {}
    __builtin_call_with_static_chain(f(), &f);

    return 0;
}

$ gcc --version
gcc (Compiler-Explorer-Build) 11.0.0 20210221 (experimental)
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ gcc -O0 test.c # Execution build compiler returned: 0

$ gcc -O1 test.c
<source>: In function 'main':
<source>:1:5: error: static chain with function that doesn't use one
    1 | int main() {
      |     ^~~~
f (); [static-chain: f]
during GIMPLE pass: *warn_unused_result
<source>:1:5: internal compiler error: 'verify_gimple' failed
0x1a31d99 internal_error(char const*, ...)
        ???:0
0xdc218d verify_gimple_in_seq(gimple*)
        ???:0
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] 3+ messages in thread

end of thread, other threads:[~2021-02-22 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-22 12:50 [Bug c/99198] New: when combinating nested function and __builtin_call_with_static_chain, optimization triggers an internal compiler error (verify_gimple) zhan3299 at purdue dot edu
2021-02-22 12:57 ` [Bug c/99198] " rguenth at gcc dot gnu.org
2021-02-22 16:05 ` msebor 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).