public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/110086] New: ICE when optimization level is changed using optimize attribute
@ 2023-06-02  8:36 senthil.thecoder at gmail dot com
  2023-06-02  9:49 ` [Bug target/110086] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: senthil.thecoder at gmail dot com @ 2023-06-02  8:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110086
           Summary: ICE when optimization level is changed using optimize
                    attribute
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: senthil.thecoder at gmail dot com
  Target Milestone: ---

Compiler crashes with an ICE for the below code. 

Already seen in regression runs (gcc.c-torture/compile/pr104327.c, for e.g.).

$ cat optimize-attrib.c 
void __attribute__((optimize("O0"))) foo() {
}
$ avr-gcc -mmcu=avr51 optimize-attrib.c -Os
optimize-attrib.c:1:1: internal compiler error: 'global_options' are modified
in local context
    1 | void __attribute__((optimize("O0"))) foo() {
      | ^~~~
0xd1288b cl_optimization_compare(gcc_options*, gcc_options*)
        /home/toolsbuild/build/gcc/gcc/options-save.cc:13139
0x832d0c handle_optimize_attribute
        /home/toolsbuild/code/gcc/gcc/c-family/c-attribs.cc:5689
0x6e8b58 decl_attributes(tree_node**, tree_node*, int, tree_node*)
        /home/toolsbuild/code/gcc/gcc/attribs.cc:878
0x70fb4c start_function(c_declspecs*, c_declarator*, tree_node*)
        /home/toolsbuild/code/gcc/gcc/c/c-decl.cc:10095
0x78eb0c c_parser_declaration_or_fndef
        /home/toolsbuild/code/gcc/gcc/c/c-parser.cc:2742
0x797ec7 c_parser_external_declaration
        /home/toolsbuild/code/gcc/gcc/c/c-parser.cc:1925
0x7987bd c_parser_translation_unit
        /home/toolsbuild/code/gcc/gcc/c/c-parser.cc:1779
0x7987bd c_parse_file()
        /home/toolsbuild/code/gcc/gcc/c/c-parser.cc:24657
0x813840 c_common_parse_file()
        /home/toolsbuild/code/gcc/gcc/c-family/c-opts.cc:1248
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.

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

* [Bug target/110086] ICE when optimization level is changed using optimize attribute
  2023-06-02  8:36 [Bug target/110086] New: ICE when optimization level is changed using optimize attribute senthil.thecoder at gmail dot com
@ 2023-06-02  9:49 ` rguenth at gcc dot gnu.org
  2023-06-19  6:32 ` cvs-commit at gcc dot gnu.org
  2023-06-19  6:34 ` senthil.thecoder at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-06-02  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
That's usually a hint of a bug in the target specific option processing code.

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

* [Bug target/110086] ICE when optimization level is changed using optimize attribute
  2023-06-02  8:36 [Bug target/110086] New: ICE when optimization level is changed using optimize attribute senthil.thecoder at gmail dot com
  2023-06-02  9:49 ` [Bug target/110086] " rguenth at gcc dot gnu.org
@ 2023-06-19  6:32 ` cvs-commit at gcc dot gnu.org
  2023-06-19  6:34 ` senthil.thecoder at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-06-19  6:32 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Senthil Kumar Selvaraj
<saaadhu@gcc.gnu.org>:

https://gcc.gnu.org/g:53953b6f31f18ac2e2241f0c1f3c8d7ecec78e7f

commit r14-1922-g53953b6f31f18ac2e2241f0c1f3c8d7ecec78e7f
Author: Senthil Kumar Selvaraj <saaadhu@gcc.gnu.org>
Date:   Mon Jun 19 11:59:12 2023 +0530

    avr: Fix ICE on optimize attribute.

    This commit fixes an ICE when an optimize attribute changes the prevailing
    optimization level.

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105069 describes the
    same ICE for the sh target, where the fix was to enable save/restore of
    target specific options modified via TARGET_OPTIMIZATION_TABLE hook.

    For the AVR target, mgas-isr-prologues and -mmain-is-OS_task are those
    target specific options. As they enable generation of more optimal code,
    this commit adds the Optimization option property to those option records,
    and that fixes the ICE.

    Regression run shows no regressions, and >100 new PASSes.

            PR target/110086

    gcc/ChangeLog:

            * config/avr/avr.opt (mgas-isr-prologues, mmain-is-OS_task):
            Add Optimization option property.

    gcc/testsuite/ChangeLog:

            * gcc.target/avr/pr110086.c: New test.

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

* [Bug target/110086] ICE when optimization level is changed using optimize attribute
  2023-06-02  8:36 [Bug target/110086] New: ICE when optimization level is changed using optimize attribute senthil.thecoder at gmail dot com
  2023-06-02  9:49 ` [Bug target/110086] " rguenth at gcc dot gnu.org
  2023-06-19  6:32 ` cvs-commit at gcc dot gnu.org
@ 2023-06-19  6:34 ` senthil.thecoder at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: senthil.thecoder at gmail dot com @ 2023-06-19  6:34 UTC (permalink / raw)
  To: gcc-bugs

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

Senthil Kumar Selvaraj <senthil.thecoder at gmail dot com> changed:

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

--- Comment #3 from Senthil Kumar Selvaraj <senthil.thecoder at gmail dot com> ---
Fixed on gcc master.

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

end of thread, other threads:[~2023-06-19  6:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-02  8:36 [Bug target/110086] New: ICE when optimization level is changed using optimize attribute senthil.thecoder at gmail dot com
2023-06-02  9:49 ` [Bug target/110086] " rguenth at gcc dot gnu.org
2023-06-19  6:32 ` cvs-commit at gcc dot gnu.org
2023-06-19  6:34 ` senthil.thecoder at gmail dot com

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).