public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/105818] New: ICE: 'global_options' are modified in local context
@ 2022-06-02  8:44 asolokha at gmx dot com
  2022-06-02  8:49 ` [Bug target/105818] " asolokha at gmx dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: asolokha at gmx dot com @ 2022-06-02  8:44 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105818
           Summary: ICE: 'global_options' are modified in local context
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: ice-checking, ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: asolokha at gmx dot com
                CC: marxin at gcc dot gnu.org
  Target Milestone: ---
            Target: powerpc-e300c3-linux-gnu

gcc 13.0.0 20220529 snapshot (g:58a40e76ebadce78639644cd3d56e42b68336927) ICEs
when compiling the following testcase, reduced from
gcc/testsuite/gcc.dg/vect/tsvc/vect-tsvc-s255.c, w/ -Os
-fno-tree-vectorize:#pragma GCC optimize "-fno-tree-vectorize"

void
foo (void)
{
  void
  bar (void);
}

% powerpc-e300c3-linux-gnu-gcc-13.0.0 -Os -fno-tree-vectorize -c sgyptdev.c
sgyptdev.c: In function 'foo':
sgyptdev.c:7:3: internal compiler error: 'global_options' are modified in local
context
    7 |   bar (void);
      |   ^~~
0xd5b42b cl_optimization_compare(gcc_options*, gcc_options*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/build/gcc/options-save.cc:14281
0x8e9234 handle_optimize_attribute
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c-family/c-attribs.cc:5581
0x7e0fa4 decl_attributes(tree_node**, tree_node*, int, tree_node*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/attribs.cc:872
0x7fe1b7 start_decl(c_declarator*, c_declspecs*, bool, tree_node*, unsigned
int*)
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-decl.cc:5232
0x8625f5 c_parser_declaration_or_fndef
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:2315
0x841333 c_parser_compound_statement_nostart
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:5720
0x862085 c_parser_compound_statement
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:5617
0x863c18 c_parser_declaration_or_fndef
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:2552
0x86c003 c_parser_external_declaration
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:1787
0x86ca5b c_parser_translation_unit
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:1660
0x86ca5b c_parse_file()
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c/c-parser.cc:23416
0x8cfb71 c_common_parse_file()
       
/var/tmp/portage/cross-powerpc-e300c3-linux-gnu/gcc-13.0.0_p20220529/work/gcc-13-20220529/gcc/c-family/c-opts.cc:1235

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

* [Bug target/105818] ICE: 'global_options' are modified in local context
  2022-06-02  8:44 [Bug target/105818] New: ICE: 'global_options' are modified in local context asolokha at gmx dot com
@ 2022-06-02  8:49 ` asolokha at gmx dot com
  2022-06-09  8:07 ` linkw at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: asolokha at gmx dot com @ 2022-06-02  8:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Arseny Solokha <asolokha at gmx dot com> ---
Sorry, there's a newline missing after the first paragraph, so the testcase
looks like this:

#pragma GCC optimize "-fno-tree-vectorize"

void
foo (void)
{
  void
  bar (void);
}

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

* [Bug target/105818] ICE: 'global_options' are modified in local context
  2022-06-02  8:44 [Bug target/105818] New: ICE: 'global_options' are modified in local context asolokha at gmx dot com
  2022-06-02  8:49 ` [Bug target/105818] " asolokha at gmx dot com
@ 2022-06-09  8:07 ` linkw at gcc dot gnu.org
  2022-06-09  9:11 ` linkw at gcc dot gnu.org
  2022-12-20  3:08 ` [Bug middle-end/105818] " linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-06-09  8:07 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2022-06-09
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |linkw at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED
                 CC|                            |linkw at gcc dot gnu.org
             Target|powerpc-e300c3-linux-gnu    |powerpc*-linux-gnu

--- Comment #2 from Kewen Lin <linkw at gcc dot gnu.org> ---
Confirmed, failed on powerpc*-linux-gnu.

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

* [Bug target/105818] ICE: 'global_options' are modified in local context
  2022-06-02  8:44 [Bug target/105818] New: ICE: 'global_options' are modified in local context asolokha at gmx dot com
  2022-06-02  8:49 ` [Bug target/105818] " asolokha at gmx dot com
  2022-06-09  8:07 ` linkw at gcc dot gnu.org
@ 2022-06-09  9:11 ` linkw at gcc dot gnu.org
  2022-12-20  3:08 ` [Bug middle-end/105818] " linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-06-09  9:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Kewen Lin <linkw at gcc dot gnu.org> ---
The different flag bit is OPTION_MASK_SAVE_TOC_INDIRECT.

  if ((rs6000_isa_flags_explicit & OPTION_MASK_SAVE_TOC_INDIRECT) == 0
      && flag_shrink_wrap_separate
      && optimize_function_for_speed_p (cfun))
    rs6000_isa_flags |= OPTION_MASK_SAVE_TOC_INDIRECT;

When parsing function foo, the call to optimize_function_for_speed_p return
OPTIMIZE_SIZE_MAX as expected, at that time function struct is null. while
parsing the decl bar,  the cfun is the one created for foo, although there is
no cgraph node for it, optimize_function_for_speed_p return OPTIMIZE_SIZE_NO.

I think when none cgraph node is found we should still return OPTIMIZE_SIZE_MAX
if optimize_size is set. It can fix this issue.

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

* [Bug middle-end/105818] ICE: 'global_options' are modified in local context
  2022-06-02  8:44 [Bug target/105818] New: ICE: 'global_options' are modified in local context asolokha at gmx dot com
                   ` (2 preceding siblings ...)
  2022-06-09  9:11 ` linkw at gcc dot gnu.org
@ 2022-12-20  3:08 ` linkw at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: linkw at gcc dot gnu.org @ 2022-12-20  3:08 UTC (permalink / raw)
  To: gcc-bugs

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

Kewen Lin <linkw at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|https://gcc.gnu.org/piperma |https://gcc.gnu.org/piperma
                   |il/gcc-patches/2022-June/59 |il/gcc-patches/2022-Novembe
                   |6628.html                   |r/607527.html

--- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> ---
Filed PR108184 to avoid to use optimize_function_for_speed_p too early, fixing
it can cover this exposed ICE, but IMHO this is still a separated issue, the
case found on aarch64 can still show that the information on size/speed is
inconsistent and this issue is worth to fixing.

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

end of thread, other threads:[~2022-12-20  3:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02  8:44 [Bug target/105818] New: ICE: 'global_options' are modified in local context asolokha at gmx dot com
2022-06-02  8:49 ` [Bug target/105818] " asolokha at gmx dot com
2022-06-09  8:07 ` linkw at gcc dot gnu.org
2022-06-09  9:11 ` linkw at gcc dot gnu.org
2022-12-20  3:08 ` [Bug middle-end/105818] " linkw 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).