public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug preprocessor/99313] New: ICE while changing global target options via pragma
@ 2021-03-01  9:50 stefansf at linux dot ibm.com
  2021-03-01 10:15 ` [Bug preprocessor/99313] " marxin at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: stefansf at linux dot ibm.com @ 2021-03-01  9:50 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99313
           Summary: ICE while changing global target options via pragma
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: preprocessor
          Assignee: unassigned at gcc dot gnu.org
          Reporter: stefansf at linux dot ibm.com
  Target Milestone: ---

#pragma GCC push_options
#pragma GCC target ("arch=z13")
#pragma GCC pop_options

$ gcc t.c -c -march=z900
test.c:3:9: internal compiler error: 'global_options' are modified in local
context
    3 | #pragma GCC pop_options
      |         ^~~
0x20035cf cl_optimization_compare(gcc_options*, gcc_options*)
        /devel/build/gcc/options-save.c:12836
0x1720b4b handle_pragma_pop_options
        /devel/src/gcc/c-family/c-pragma.c:1092
0x17218a5 c_invoke_pragma_handler(unsigned int)
        /devel/src/gcc/c-family/c-pragma.c:1515
0x1636ed7 c_parser_pragma
        /devel/src/gcc/c/c-parser.c:12519
0x1617165 c_parser_external_declaration
        /devel/src/gcc/c/c-parser.c:1758
0x1616c51 c_parser_translation_unit
        /devel/src/gcc/c/c-parser.c:1650
0x1660487 c_parse_file()
        /devel/src/gcc/c/c-parser.c:21984
0x1718aab c_common_parse_file()
        /devel/src/gcc/c-family/c-opts.c:1218
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.

Started with dc6d15eaa23cbae1468a6ef92371b1c856c14819

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

* [Bug preprocessor/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
@ 2021-03-01 10:15 ` marxin at gcc dot gnu.org
  2021-03-01 10:33 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-01 10:15 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
g:dc6d15eaa23cbae1468a6ef92371b1c856c14819

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

* [Bug preprocessor/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
  2021-03-01 10:15 ` [Bug preprocessor/99313] " marxin at gcc dot gnu.org
@ 2021-03-01 10:33 ` marxin at gcc dot gnu.org
  2021-03-01 14:05 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-01 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |marxin at gcc dot gnu.org
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2021-03-01

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
The diff comes from here:

(gdb) p ptr1->x_param_max_completely_peel_times
$3 = 16
(gdb) p ptr2->x_param_max_completely_peel_times
$4 = 64

Which comes from here:

  if (opts->x_s390_tune >= PROCESSOR_2097_Z10)
    {
      SET_OPTION_IF_UNSET (opts, opts_set, param_max_unrolled_insns,
                           100);
      SET_OPTION_IF_UNSET (opts, opts_set, param_max_unroll_times, 32);
      SET_OPTION_IF_UNSET (opts, opts_set, param_max_completely_peeled_insns,
                           2000);
      SET_OPTION_IF_UNSET (opts, opts_set, param_max_completely_peel_times,
                           64);
    }

So this is an obvious situation where a target option modified optimization
options that is global.
I'm going to add exceptions for it.

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

* [Bug preprocessor/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
  2021-03-01 10:15 ` [Bug preprocessor/99313] " marxin at gcc dot gnu.org
  2021-03-01 10:33 ` marxin at gcc dot gnu.org
@ 2021-03-01 14:05 ` rguenth at gcc dot gnu.org
  2021-03-01 14:24 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-03-01 14:05 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
But this results in unexpected behavior when there's functions with arch=z13
vs. arch=z9 and depending on "luck" we then inherit the wrong params where
we should not?

That said, when unifying target/optimize options these should be handled
and stored once, right?

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

* [Bug preprocessor/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
                   ` (2 preceding siblings ...)
  2021-03-01 14:05 ` rguenth at gcc dot gnu.org
@ 2021-03-01 14:24 ` marxin at gcc dot gnu.org
  2021-03-01 14:42 ` [Bug target/99313] " cvs-commit at gcc dot gnu.org
  2021-03-01 14:44 ` marxin at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-01 14:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Richard Biener from comment #3)
> But this results in unexpected behavior when there's functions with arch=z13
> vs. arch=z9 and depending on "luck" we then inherit the wrong params where
> we should not?

Yes.

> 
> That said, when unifying target/optimize options these should be handled
> and stored once, right?

Exactly, that's the original motivation for merging of them.

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

* [Bug target/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
                   ` (3 preceding siblings ...)
  2021-03-01 14:24 ` marxin at gcc dot gnu.org
@ 2021-03-01 14:42 ` cvs-commit at gcc dot gnu.org
  2021-03-01 14:44 ` marxin at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-01 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:4ed0a92f6cfc647e2ad8ceaa1e5709545c915465

commit r11-7442-g4ed0a92f6cfc647e2ad8ceaa1e5709545c915465
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Mar 1 15:41:14 2021 +0100

    s390: add exceptions for param modified by target pragma

    gcc/ChangeLog:

            PR target/99313
            * optc-save-gen.awk: Add 4 more exceptions.

    gcc/testsuite/ChangeLog:

            PR target/99313
            * gcc.target/s390/target-attribute/pr99313.c: New test.

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

* [Bug target/99313] ICE while changing global target options via pragma
  2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
                   ` (4 preceding siblings ...)
  2021-03-01 14:42 ` [Bug target/99313] " cvs-commit at gcc dot gnu.org
@ 2021-03-01 14:44 ` marxin at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-03-01 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master.

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

end of thread, other threads:[~2021-03-01 14:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-01  9:50 [Bug preprocessor/99313] New: ICE while changing global target options via pragma stefansf at linux dot ibm.com
2021-03-01 10:15 ` [Bug preprocessor/99313] " marxin at gcc dot gnu.org
2021-03-01 10:33 ` marxin at gcc dot gnu.org
2021-03-01 14:05 ` rguenth at gcc dot gnu.org
2021-03-01 14:24 ` marxin at gcc dot gnu.org
2021-03-01 14:42 ` [Bug target/99313] " cvs-commit at gcc dot gnu.org
2021-03-01 14:44 ` marxin 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).