[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2024-03-26 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

Andrew Pinski  changed:

   What|Removed |Added

 CC||bki at hacon dot de

--- Comment #92 from Andrew Pinski  ---
*** Bug 85961 has been marked as a duplicate of this bug. ***

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-06 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #91 from David Binderman  ---
I confirm that the problem seems fixed to me in today's trunk.
Thanks to everyone for what has been an unusually difficult bug to find.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-05 Thread ubizjak at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860
Bug 92860 depends on bug 103905, which changed state.

Bug 103905 Summary: [12 Regression] Miscompiled i386-expand.c with 
-march=bdver1 and -O3 since r12-1789-g836328b2c99f5b8d
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103905

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-05 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #90 from Martin Liška  ---
Note that I can bootstrap with -O3 -march=native on bdver1 when I apply the fix
for PR103905.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

Martin Liška  changed:

   What|Removed |Added

   See Also||https://gcc.gnu.org/bugzill
   ||a/show_bug.cgi?id=103905
 Status|NEW |RESOLVED
 Resolution|--- |FIXED

--- Comment #89 from Martin Liška  ---
Closing as the miscompilation is unrelated to this.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #88 from Martin Liška  ---
And the miscompiled file is i386-expand.o.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #87 from Martin Liška  ---
Self-contained test-case:

$ cat options-save2.ii
char flags[16];

int one = 1, two = 2;

void
__attribute__ ((noipa))
save() {
  flags[0] = one;
  flags[1] = one;
  flags[2] = one;
  flags[3] = one;
  flags[4] = one;
  flags[5] = one;
  flags[6] = one;
  flags[7] = one;
  flags[8] = one;
  flags[9] = one;
  flags[10] = one;
  flags[11] = one;
  flags[12] = one;
  flags[13] = one;
  flags[14] = one;
  flags[15] = two;
}

int
main()
{
  save ();

  __builtin_printf ("flags[0]=%d, flags[15]=%d\n", flags[0], flags[15]);
  if (flags[15] != 2)
__builtin_abort ();

  return 0;
}

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #86 from Martin Liška  ---
Optimized dump is equal:

void cl_optimization_save ()
{
  vector(8) short int vect__2.20;
  vector(16) char vect__2.19;
  int val0.0_1;
  int val1.15_3;
  vector(4) int _22;
  vector(4) int _25;

   [local count: 1073741824]:
  val0.0_1 = val0;
  _25 = {val0.0_1, val0.0_1, val0.0_1, val0.0_1};
  val1.15_3 = val1;
  _22 = {val0.0_1, val0.0_1, val0.0_1, val1.15_3};
  vect__2.20_26 = VEC_PACK_TRUNC_EXPR <_25, _25>;
  vect__2.20_27 = VEC_PACK_TRUNC_EXPR <_25, _22>;
  vect__2.19_28 = VEC_PACK_TRUNC_EXPR ;
  MEM  [(char *)_optimization_save_ptr] = vect__2.19_28;
  return;

}

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #85 from Martin Liška  ---
Ok, so the options-save.c is really miscompiled. I reduced that down to:

$ cat options-save2.ii
struct cl_optimization {
  /* All have value 0. */
  char x_flag_keep_gc_roots_live;
  char x_flag_lifetime_dse;
  char x_flag_limit_function_alignment;
  char x_flag_live_range_shrinkage;
  char x_flag_loop_interchange;
  char x_flag_loop_nest_optimize;
  char x_flag_loop_parallelize_all;
  char x_flag_unroll_jam;
  char x_flag_lra_remat;
  char x_flag_errno_math;
  char x_flag_modulo_sched;
  char x_flag_modulo_sched_allow_regmoves;
  char x_flag_move_loop_invariants;
  char x_flag_move_loop_stores;
  char x_flag_non_call_exceptions;
  /* Value 1. */
  char x_flag_nothrow_opt;
} cl_optimization_save_ptr;

int val0, val1;

void cl_optimization_save() {
  cl_optimization_save_ptr.x_flag_keep_gc_roots_live = val0;
  cl_optimization_save_ptr.x_flag_lifetime_dse = val0;
  cl_optimization_save_ptr.x_flag_limit_function_alignment = val0;
  cl_optimization_save_ptr.x_flag_live_range_shrinkage = val0;
  cl_optimization_save_ptr.x_flag_loop_interchange = val0;
  cl_optimization_save_ptr.x_flag_loop_nest_optimize = val0;
  cl_optimization_save_ptr.x_flag_loop_parallelize_all = val0;
  cl_optimization_save_ptr.x_flag_unroll_jam = val0;
  cl_optimization_save_ptr.x_flag_lra_remat = val0;
  cl_optimization_save_ptr.x_flag_errno_math = val0;
  cl_optimization_save_ptr.x_flag_modulo_sched = val0;
  cl_optimization_save_ptr.x_flag_modulo_sched_allow_regmoves = val0;
  cl_optimization_save_ptr.x_flag_move_loop_invariants = val0;
  cl_optimization_save_ptr.x_flag_move_loop_stores = val0;
  cl_optimization_save_ptr.x_flag_non_call_exceptions = val0;
  cl_optimization_save_ptr.x_flag_nothrow_opt = val1;
}

$ /tmp/gcc/objdir2/./gcc/xg++ -B/tmp/gcc/objdir2/./gcc/ -O2 options-save2.ii -S
-O3 -march=core2 -o good.s -fno-checking -fdump-rtl-final=good.txt

$ /tmp/gcc/objdir/./prev-gcc/xg++ -B/tmp/gcc/objdir/./prev-gcc/ -O2
options-save2.ii -S -O3 -march=core2 -o good.s -fno-checking
-fdump-rtl-final=bad.txt

diff good.txt bad.txt prints:

 (insn:TI 12 5 39 2 (set (reg:V16QI 23 xmm3 [94])
 (mem/u/c:V16QI (symbol_ref/u:DI ("*.LC1") [flags 0x2]) [0  S16 A128]))
"options-save2.ii":25:54 1652 {movv16qi_internal}
  (expr_list:REG_EQUIV (const_vector:V16QI [
 (const_int -128 [0xff80]) repeated x8
 (const_int 0 [0])
 (const_int 1 [0x1])
 (const_int 4 [0x4])
 (const_int 5 [0x5])
-(const_int 8 [0x8])
-(const_int 9 [0x9])
-(const_int 12 [0xc])
-(const_int 13 [0xd])
+(const_int -128 [0xff80]) repeated x4
 ])
 (nil)))

So as seen, different vector constants are saved to xmm3.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #84 from Martin Liška  ---
Thanks David for help!

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

Martin Liška  changed:

   What|Removed |Added

 Status|WAITING |NEW

--- Comment #83 from Martin Liška  ---
I was able to reproduce that, analyzing it right now.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #82 from David Binderman  ---
(In reply to rguent...@suse.de from comment #79)
> OK, so can you - in a -march=bdver2 built tree (that then fails) - produce
> options-save.ii (preprocessed source) and attach that?  

Done.

> Can you try whether you get past the failure point when you add 
> -fno-tree-vectorize to just the options-save.o compilation?  

Flag doesn't help.

> Can you provide the -v output
> of the options-save.o compile so we get the exact cc1plus invocation?

Compile command is this:

/home/dcb/gcc/working/./gcc/xgcc -B/home/dcb/gcc/working/./gcc/
-B/home/dcb/gcc/results.20220104/x86_64-pc-linux-
gnu/bin/ -B/home/dcb/gcc/results.20220104/x86_64-pc-linux-gnu/lib/ -isystem
/home/dcb/gcc/results.20220104/x86_64
-pc-linux-gnu/include -isystem
/home/dcb/gcc/results.20220104/x86_64-pc-linux-gnu/sys-include   -fchecking=1
-g -
O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wno-e
rror=format-diag -Wstrict-prototypes -Wmissing-prototypes
-Wno-error=format-diag -Wold-style-definition  -isystem
 ./include  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection -mshstk -g
-DIN_LIBGCC2 -fbuilding-libgcc -fn
o-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection
-mshstk -I. -I. -I../.././gcc -I../../
../trunk.git/libgcc -I../../../trunk.git/libgcc/.
-I../../../trunk.git/libgcc/../gcc -I../../../trunk.git/libgcc/
../include -I../../../trunk.git/libgcc/config/libbid
-DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS  -MT un
wind-dw2.o -MD -MP -MF unwind-dw2.dep -fexceptions -c -fno-tree-vectorize
../../../trunk.git/libgcc/unwind-dw2.c 
-fvisibility=hidden -DHIDE_EXPORTS 

cc1 command line is

 /home/dcb/gcc/working/./gcc/cc1 -quiet -v -I . -I . -I ../.././gcc -I
../../../trunk.git/libgcc -I ../../../trunk.git/libgcc/. -I
../../../trunk.git/libgcc/../gcc -I ../../../trunk.git/libgcc/../include -I
../../../trunk.git/libgcc/config/libbid -iprefix
/home/dcb/gcc/working/gcc/../lib/gcc/x86_64-pc-linux-gnu/12.0.0/ -isystem
/home/dcb/gcc/working/./gcc/include -isystem
/home/dcb/gcc/working/./gcc/include-fixed -MD unwind-dw2.d -MF unwind-dw2.dep
-MP -MT unwind-dw2.o -D IN_GCC -D USE_ELF_SYMVER -D IN_LIBGCC2 -D
USE_ELF_SYMVER -D ENABLE_DECIMAL_BID_FORMAT -D HAVE_CC_TLS -D USE_TLS -D
HIDE_EXPORTS -isystem
/home/dcb/gcc/results.20220104/x86_64-pc-linux-gnu/include -isystem
/home/dcb/gcc/results.20220104/x86_64-pc-linux-gnu/sys-include -isystem
./include ../../../trunk.git/libgcc/unwind-dw2.c -march=bdver2 -mmmx -mpopcnt
-msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mavx -mno-avx2 -msse4a -mfma4
-mxop -mfma -mno-avx512f -mbmi -mno-bmi2 -maes -mpclmul -mno-avx512vl
-mno-avx512bw -mno-avx512dq -mno-avx512cd -mno-avx512er -mno-avx512pf
-mno-avx512vbmi -mno-avx512ifma -mno-avx5124vnniw -mno-avx5124fmaps
-mno-avx512vpopcntdq -mno-avx512vbmi2 -mno-gfni -mno-vpclmulqdq -mno-avx512vnni
-mno-avx512bitalg -mno-avx512bf16 -mno-avx512vp2intersect -mno-3dnow -mno-adx
-mabm -mno-cldemote -mno-clflushopt -mno-clwb -mno-clzero -mcx16 -mno-enqcmd
-mf16c -mno-fsgsbase -mfxsr -mno-hle -msahf -mlwp -mlzcnt -mno-movbe
-mno-movdir64b -mno-movdiri -mno-mwaitx -mno-pconfig -mno-pku -mno-prefetchwt1
-mprfchw -mno-ptwrite -mno-rdpid -mno-rdrnd -mno-rdseed -mno-rtm -mno-serialize
-mno-sgx -mno-sha -mno-shstk -mtbm -mno-tsxldtrk -mno-vaes -mno-waitpkg
-mno-wbnoinvd -mxsave -mno-xsavec -mno-xsaveopt -mno-xsaves -mno-amx-tile
-mno-amx-int8 -mno-amx-bf16 -mno-uintr -mno-hreset -mno-kl -mno-widekl
-mno-avxvnni -mno-avx512fp16 --param l1-cache-size=16 --param
l1-cache-line-size=64 --param l2-cache-size=2048 -mtune=bdver2 -quiet -dumpbase
unwind-dw2.c -dumpbase-ext .c -mlong-double-80 -mshstk -g -g -g -O3 -O2 -O3
-Wextra -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
-Wold-style-definition -version -fchecking=1 -fcf-protection=full
-fbuilding-libgcc -fno-stack-protector -fpic -fcf-protection=full -fexceptions
-fvisibility=hidden

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #81 from David Binderman  ---
Created attachment 52118
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52118=edit
preprocessed source code

Bug seems to have moved to unwind-dw2.c. Preprocessed source code attached.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-04 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #80 from Martin Liška  ---
I've got access to a bdver2 machine, so I should be able to reproduce it.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-03 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #79 from rguenther at suse dot de  ---
On Mon, 3 Jan 2022, dcb314 at hotmail dot com wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860
> 
> --- Comment #77 from David Binderman  ---
> (In reply to rguent...@suse.de from comment #76)
> > Maybe the issue reproduces with only -mtune=bdver2 or with -march=bdver2 
> > -mno-xop (XOP is what's removed from znver2 for example, not 100% sure
> > that's all, but ...).  It does sound like eventually options-save.c
> > is miscompiled somehow ...
> 
> Thanks for the guidance.
> 
> I tried a build with -march=bdver2 -mno-xop and it worked fine.
> 
> So the xop feature is the culprit.

OK, so can you - in a -march=bdver2 built tree (that then fails) - produce
options-save.ii (preprocessed source) and attach that?  Can you try
whether you get past the failure point when you add -fno-tree-vectorize
to just the options-save.o compilation?  Can you provide the -v output
of the options-save.o compile so we get the exact cc1plus invocation?

I'll then try to figure out what goes wrong by looking at the
assembly output.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-03 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #78 from David Binderman  ---
-mxop adds 124 functions. I am not sure how to find out which ones are broken.

Is there some way to add only some of the 124 into the machine description ?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-03 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #77 from David Binderman  ---
(In reply to rguent...@suse.de from comment #76)
> Maybe the issue reproduces with only -mtune=bdver2 or with -march=bdver2 
> -mno-xop (XOP is what's removed from znver2 for example, not 100% sure
> that's all, but ...).  It does sound like eventually options-save.c
> is miscompiled somehow ...

Thanks for the guidance.

I tried a build with -march=bdver2 -mno-xop and it worked fine.

So the xop feature is the culprit.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2022-01-03 Thread rguenther at suse dot de via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #76 from rguenther at suse dot de  ---
On Tue, 14 Dec 2021, marxin at gcc dot gnu.org wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860
> 
> --- Comment #75 from Martin Liška  ---
> (In reply to David Binderman from comment #74)
> > (In reply to Martin Liška from comment #72)
> > > You will manage, it's not rocket science.
> > > 
> > > So please, add break point at the place it triggers the ICE and do:
> > > 
> > > (gdb) p >x_help_flag
> > > (gdb) p >x_help_flag
> > 
> > For this to work, I had to replace the options-save.o with a version
> > compiled by -O0 and that made the problem go away ;-<
> 
> Or you would have to print >x_help_flag with a printf and then
> use gdb for the memory.
> 
> > 
> > I am still happy to walk away from this bug report. It is known
> > to occur on only one variant of one architecture and it is hard
> > to reproduce. I can think of better things to work on in gcc.
> 
> Ok...
> 
> > 
> > As far as finding a machine with a bdver2 architecture, I suspect
> > any more recent AMD machine would be fine. 
> > 
> > Has no one checked the compile farm ?
> 
> No, there's not a bdver2 machine.

Maybe the issue reproduces with only -mtune=bdver2 or with -march=bdver2 
-mno-xop (XOP is what's removed from znver2 for example, not 100% sure
that's all, but ...).  It does sound like eventually options-save.c
is miscompiled somehow ...

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-14 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #75 from Martin Liška  ---
(In reply to David Binderman from comment #74)
> (In reply to Martin Liška from comment #72)
> > You will manage, it's not rocket science.
> > 
> > So please, add break point at the place it triggers the ICE and do:
> > 
> > (gdb) p >x_help_flag
> > (gdb) p >x_help_flag
> 
> For this to work, I had to replace the options-save.o with a version
> compiled by -O0 and that made the problem go away ;-<

Or you would have to print >x_help_flag with a printf and then
use gdb for the memory.

> 
> I am still happy to walk away from this bug report. It is known
> to occur on only one variant of one architecture and it is hard
> to reproduce. I can think of better things to work on in gcc.

Ok...

> 
> As far as finding a machine with a bdver2 architecture, I suspect
> any more recent AMD machine would be fine. 
> 
> Has no one checked the compile farm ?

No, there's not a bdver2 machine.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-14 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #74 from David Binderman  ---
(In reply to Martin Liška from comment #72)
> You will manage, it's not rocket science.
> 
> So please, add break point at the place it triggers the ICE and do:
> 
> (gdb) p >x_help_flag
> (gdb) p >x_help_flag

For this to work, I had to replace the options-save.o with a version
compiled by -O0 and that made the problem go away ;-<

I am still happy to walk away from this bug report. It is known
to occur on only one variant of one architecture and it is hard
to reproduce. I can think of better things to work on in gcc.

As far as finding a machine with a bdver2 architecture, I suspect
any more recent AMD machine would be fine. 

Has no one checked the compile farm ?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-14 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #73 from Arseny Solokha  ---
(In reply to Martin Liška from comment #67)
> (In reply to Arseny Solokha from comment #66)
> > Should I file my commend 38 as a separate PR, then?
> 
> Yes, please.

Filed as PR103709.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-14 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #72 from Martin Liška  ---
You will manage, it's not rocket science.

So please, add break point at the place it triggers the ICE and do:

(gdb) p >x_help_flag
(gdb) p >x_help_flag

and then watch for the addresses it prints:

watch *$number

where $number is returned from the 'p &' command. And then re-run the program
and you should see the:


Old value=...
New value=...

and you can print bt.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-14 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #71 from David Binderman  ---
(In reply to Martin Liška from comment #57)
> (In reply to David Binderman from comment #56)
> > (In reply to Martin Liška from comment #55)
> > > > 
> > > > with line numbers please :)
> > > 
> > > cat -n can do that
> > 
> > Sorry, I went a bit hard-of-thinking there. 
> > 
> >  13029  void
> >  13030  cl_optimization_compare (gcc_options *ptr1, gcc_options *ptr2)
> >  13031  {
> >  13032if (ptr1->x_help_flag != ptr2->x_help_flag)
> >  13033  internal_error ("% are modified in local
> > context");
> >  13034if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
> >  13035  internal_error ("% are modified in local
> > context");
> >  13036if (ptr1->x_param_align_loop_iterations !=
> > ptr2->x_param_align_loop_iterations)
> >  13037  internal_error ("% are modified in local
> > context");
> >  13038if (ptr1->x_param_align_threshold != 
> > ptr2->x_param_align_threshold)
> >  13039  internal_error ("% are modified in local
> > context");
> >  13040if (ptr1->x_param_analyzer_bb_explosion_factor !=
> > ptr2->x_param_analyzer_bb_explosion_factor)
> >  13041  internal_error ("% are modified in local
> > context");
> >  13042if (ptr1->x_param_analyzer_max_constraints !=
> > ptr2->x_param_analyzer_max_constraints)
> >  13043  internal_error ("% are modified in local
> > context");
> > 
> > So the first test is failing.
> 
> Hm, that's super-weird. It should be 0 for both of them. Can you please
> build options-save.c with -O0 and debug it:
> 
> (gdb) b cl_optimization_compare
> (gdb) p ptr1->x_help_flag
> $1 = 0
> (gdb) p ptr2->x_help_flag
> $2 = 0
> 
> and then put a watch for the value that is non-zero:
> (gdb) p >x_help_flag
> $3 = (int *) 0x26c87d0
> (gdb) watch *$3
> Hardware watchpoint 4: *$3
> (gdb) r
> Old value = 
> New value = 0
> handle_pragma_push_options (dummy=) at
> /home/marxin/Programming/gcc/gcc/c-family/c-pragma.c:1041
> 1041*p->saved_global_options = global_options;
> (gdb) c

I think I understand most of your instructions, although it's decades
since I played with gdb.

Stack backtrace gives me:

(gdb) bt
#0  __memcpy_ssse3 () at ../sysdeps/x86_64/multiarch/memcpy-ssse3.S:262
#1  0x776d815b in _int_realloc (
av=av@entry=0x77835aa0 , oldp=oldp@entry=0x2e75f10, 
oldsize=14624, nb=nb@entry=21920) at malloc.c:4786
#2  0x776d8f49 in __GI___libc_realloc (oldmem=0x2e75f20, bytes=21912)
at malloc.c:3372
#3  0x01e09e0e in xrealloc (oldmem=0x2e7bc70, size=21912)
at ../../trunk.git/libiberty/xmalloc.c:181
#4  0x007b91dd in va_heap::reserve (v=, 
reserve=, exact=)
at ../../trunk.git/gcc/vec.h:290
#5  vec::reserve (this=0x2df6ca8, nelems=1, 
exact=false) at ../../trunk.git/gcc/vec.h:1858
#6  vec::safe_push (this=0x2df6ca8, obj=...)
at ../../trunk.git/gcc/vec.h:1967
#7  0x007b65a4 in add_finalizer (result=0x7fffe9f75270, 
f=0x691dc0 (void*)>, s=0, n=1)
at ../../trunk.git/gcc/ggc-page.c:1264
#8  ggc_internal_alloc (size=, size@entry=48, 
f=0x691dc0 (void*)>, s=s@entry=0, n=n@entry=1)
at ../../trunk.git/gcc/ggc-page.c:1421
#9  0x0066f18d in ggc_alloc ()
at ../../trunk.git/gcc/ggc.h:185
#10 bind (name=name@entry=0x7fffe9f71b40, decl=decl@entry=0x7fffe9f76000, 
scope=0x7fffe9f07300, invisible=true, nested=false, locus=locus@entry=0)
at ../../trunk.git/gcc/c/c-decl.c:738
#11 0x006774d4 in c_builtin_function (decl=0x7fffe9f76000)
at ../../trunk.git/gcc/c/c-decl.c:4585
#12 0x00750d62 in def_builtin_1 (fncode=BUILT_IN_GAMMAF_R, 
name=0x1e3d121 "__builtin_gammaf_r", fnclass=BUILT_IN_NORMAL, 
fntype=0x7fffe9f3e930, libtype=0x7fffe9f3e930, both_p=true, 
fallback_p=, nonansi_p=true, fnattrs=0x7fffe9f50398, 
implicit_p=false) at ../../trunk.git/gcc/c-family/c-common.c:4923
#13 0x0072b118 in c_define_builtins (

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #70 from Martin Liška  ---
I'm sorry, but I don't have an access to a bdver2 machine.
Anyway, can you please debug what I asked in #c57?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-13 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #69 from David Binderman  ---
(In reply to Martin Liška from comment #68)
> > Righto. This is proving unexpectedly hard to reproduce.
> 
> Ok, so please tell me exact steps how to reproduce it.

First of all, get a -march=bdver2 machine. Install Fedora Linux.
Get recent gcc trunk.

Use this configure command:

../trunk.git/configure \
--disable-multilib \
--disable-werror \
--enable-checking=df,extra,fold,rtl,yes \
--enable-languages=c,c++

sed 's/-O2/-O3 -march=native/' < Makefile > Makefile.tmp
diff Makefile Makefile.tmp
mv Makefile.tmp Makefile

Build it and see what happens. I suspect that you won't need all the checking
flags I use. 

I also suspect that the recent fix for bug # 103515 might affect the
results, but let's see.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #68 from Martin Liška  ---
> Righto. This is proving unexpectedly hard to reproduce.

Ok, so please tell me exact steps how to reproduce it.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-13 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #67 from Martin Liška  ---
(In reply to Arseny Solokha from comment #66)
> Should I file my commend 38 as a separate PR, then?

Yes, please.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-12 Thread asolokha at gmx dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #66 from Arseny Solokha  ---
Should I file my commend 38 as a separate PR, then?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-12 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #65 from David Binderman  ---
(In reply to David Binderman from comment #63)
> OR: I do a fishing trip for revisions some unknown time before
> 2020-06-11 (the known bad date), to find a known good date, then
> run git bisect from there.
> 
> In furtherance of option 2 and given that Jun 2020 is long enough
> ago that the git rev-list will have expired (it is only valid for 90 days),
> am I correct in thinking that something like
> 
> git rev-list -n 1 --first-parent --before="2020-01-01" master
> 
> will give me a git hash of a revision of the first day of year 2020
> and so
> 
> git checkout `that git hash`
> 
> will get me to that date, so I can run a build ?

Yes, those git commands seem to successfully get me backwards
and forwards on the git timeline, but I am struggling to get anything
to build. I've tried:

2020-04-11 : f883c46b4877f637e0fa5025b4d6b5c9040ec566 good ? cyclades problems
2020-05-11 : dbeaa7ab81a37acadc9af6e7990332604252de20 failed to build
2020-06-11 : 419c355c7a871513e1065b7cec32dd456eb4a0e5 failed to build
2020-07-11 : c19f95fb1b8f15090eb1d1682e86de425fbd3c78 failed to build
2020-08-11 : 1118a3ff9d3ad6a64bba25dc01e7703325e23d92 failed to build
2020-09-11 : 8d3767c30240c901a493d82d9d20f306b2f0152d failed to build

where column 1 is a date, column 3 is the git hash and column 4
indicates that I could only build one of the versions I tried,
from Apr 2021, and that was questionable, because of problems
with cyclades header files. I had to use make -k in the end.

Most of the rest stopped with this error message:

/usr/include/stdio.h:183:3: error: wrong number of arguments specified for
‘malloc’ attribute
/usr/include/stdio.h:183:3: error: wrong number of arguments specified for
‘malloc’ attribute
/usr/include/stdio.h:183:3: error: wrong number of arguments specified for
‘malloc’ attribute
/usr/include/stdio.h:195:4: error: wrong number of arguments specified for
‘malloc’ attribute

I don't know how to fix that.

Given the copious activity and lack of progress on this bug report, I would
be happy for it to be closed down as "cannot reproduce".

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-11 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #64 from David Binderman  ---
(In reply to David Binderman from comment #63)
> (In reply to Martin Liška from comment #62)
> > Can't reproduce with the current master:
> 
> Righto. This is proving unexpectedly hard to reproduce.
> 
> EITHER: I search various values of march= to find out which
> ones work and which ones don't.

Works fine with -march=amdfam10, broken with -march=bdver2.

I have no idea how to work out the halfway point between these two
architectures.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-11 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #63 from David Binderman  ---
(In reply to Martin Liška from comment #62)
> Can't reproduce with the current master:

Righto. This is proving unexpectedly hard to reproduce.

EITHER: I search various values of march= to find out which
ones work and which ones don't.

OR: I do a fishing trip for revisions some unknown time before
2020-06-11 (the known bad date), to find a known good date, then
run git bisect from there.

In furtherance of option 2 and given that Jun 2020 is long enough
ago that the git rev-list will have expired (it is only valid for 90 days),
am I correct in thinking that something like

git rev-list -n 1 --first-parent --before="2020-01-01" master

will give me a git hash of a revision of the first day of year 2020
and so

git checkout `that git hash`

will get me to that date, so I can run a build ?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-10 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

Martin Liška  changed:

   What|Removed |Added

 Status|NEW |WAITING

--- Comment #62 from Martin Liška  ---
(In reply to David Binderman from comment #61)
> Created attachment 51964 [details]
> C source code
> 
> Command line used to compile file:
> 
> /home/dcb/gcc/working.2/./gcc/xgcc -B/home/dcb/gcc/working.2/./gcc/
> -B/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/bin/
> -B/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/lib/ -isystem
> /home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/include -isystem
> /home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/sys-include  
> -fchecking=1 -g -O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W
> -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
> -Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
> -Wold-style-definition  -isystem ./include  -fpic -mlong-double-80
> -DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
> -fno-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER
> -fcf-protection -mshstk -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
> -I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
> -I../../../trunk.git/libgcc/../include
> -I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
> -DHAVE_CC_TLS  -DUSE_TLS  -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF
> unwind-dw2.dep -fexceptions -c ../../../trunk.git/libgcc/unwind-dw2.c
> -fvisibility=hidden -DHIDE_EXPORTS

Can't reproduce with the current master:

./xgcc -B. /home/marxin/Programming/testcases/pr92860.c -g -O3 -march=bdver2
-fchecking=1 -g -O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W
-Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
-Wold-style-definition  -isystem ./include  -fpic -mlong-double-80
-DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection
-mshstk -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
-I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
-I../../../trunk.git/libgcc/../include
-I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
-DHAVE_CC_TLS  -DUSE_TLS  -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF
unwind-dw2.dep -fexceptions -fvisibility=hidden -DHIDE_EXPORTS -c

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-09 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #61 from David Binderman  ---
Created attachment 51964
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51964=edit
C source code

Command line used to compile file:

/home/dcb/gcc/working.2/./gcc/xgcc -B/home/dcb/gcc/working.2/./gcc/
-B/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/bin/
-B/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/lib/ -isystem
/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/include -isystem
/home/dcb/gcc/results.20211209/x86_64-pc-linux-gnu/sys-include   -fchecking=1
-g -O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
-Wold-style-definition  -isystem ./include  -fpic -mlong-double-80
-DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection
-mshstk -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
-I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
-I../../../trunk.git/libgcc/../include
-I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
-DHAVE_CC_TLS  -DUSE_TLS  -o unwind-dw2.o -MT unwind-dw2.o -MD -MP -MF
unwind-dw2.dep -fexceptions -c ../../../trunk.git/libgcc/unwind-dw2.c
-fvisibility=hidden -DHIDE_EXPORTS

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-09 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #60 from David Binderman  ---
(In reply to Martin Liška from comment #59)
> Most of the issues were fixed in GCC 12 stage1.
> There are still corner cases, but the current situation should be much
> better.

Not for me, they aren't. 

I can reproduce it on today's trunk, but any *.i file I produce seems to 
compile fine ;-<

I will attach the *.i file and the command line.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-12-09 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

Martin Liška  changed:

   What|Removed |Added

   Assignee|marxin at gcc dot gnu.org  |unassigned at gcc dot 
gnu.org
 Status|ASSIGNED|NEW

--- Comment #59 from Martin Liška  ---
Most of the issues were fixed in GCC 12 stage1.
There are still corner cases, but the current situation should be much better.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-08-16 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860
Bug 92860 depends on bug 99592, which changed state.

Bug 99592 Summary: arm: internal compiler error using arm_neon.h with -pg
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99592

   What|Removed |Added

 Status|WAITING |RESOLVED
 Resolution|--- |FIXED

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #58 from David Binderman  ---
(In reply to Martin Liška from comment #57)
> Can you please build options-save.c with -O0 and debug it:

Good idea, but I have run out of time on this issue. 
Another 40 or so interesting commits have appeared
in gcc trunk.

It only seems to affect bdver2 and you've had multiple failures
to reproduce, so I am happy to put this one on hold for a week.

I plan to do another full -O3 -march=native bootstrap in a week.
I will look into this problem then.

I am happy for someone else to pick this one up. Sorry I can't do more,
but then that's the nature of volunteer work.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #57 from Martin Liška  ---
(In reply to David Binderman from comment #56)
> (In reply to Martin Liška from comment #55)
> > > 
> > > with line numbers please :)
> > 
> > cat -n can do that
> 
> Sorry, I went a bit hard-of-thinking there. 
> 
>  13029  void
>  13030  cl_optimization_compare (gcc_options *ptr1, gcc_options *ptr2)
>  13031  {
>  13032if (ptr1->x_help_flag != ptr2->x_help_flag)
>  13033  internal_error ("% are modified in local
> context");
>  13034if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
>  13035  internal_error ("% are modified in local
> context");
>  13036if (ptr1->x_param_align_loop_iterations !=
> ptr2->x_param_align_loop_iterations)
>  13037  internal_error ("% are modified in local
> context");
>  13038if (ptr1->x_param_align_threshold != ptr2->x_param_align_threshold)
>  13039  internal_error ("% are modified in local
> context");
>  13040if (ptr1->x_param_analyzer_bb_explosion_factor !=
> ptr2->x_param_analyzer_bb_explosion_factor)
>  13041  internal_error ("% are modified in local
> context");
>  13042if (ptr1->x_param_analyzer_max_constraints !=
> ptr2->x_param_analyzer_max_constraints)
>  13043  internal_error ("% are modified in local
> context");
> 
> So the first test is failing.

Hm, that's super-weird. It should be 0 for both of them. Can you please build
options-save.c with -O0 and debug it:

(gdb) b cl_optimization_compare
(gdb) p ptr1->x_help_flag
$1 = 0
(gdb) p ptr2->x_help_flag
$2 = 0

and then put a watch for the value that is non-zero:
(gdb) p >x_help_flag
$3 = (int *) 0x26c87d0
(gdb) watch *$3
Hardware watchpoint 4: *$3
(gdb) r
Old value = 
New value = 0
handle_pragma_push_options (dummy=) at
/home/marxin/Programming/gcc/gcc/c-family/c-pragma.c:1041
1041  *p->saved_global_options = global_options;
(gdb) c

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #56 from David Binderman  ---
(In reply to Martin Liška from comment #55)
> > 
> > with line numbers please :)
> 
> cat -n can do that

Sorry, I went a bit hard-of-thinking there. 

 13029  void
 13030  cl_optimization_compare (gcc_options *ptr1, gcc_options *ptr2)
 13031  {
 13032if (ptr1->x_help_flag != ptr2->x_help_flag)
 13033  internal_error ("% are modified in local
context");
 13034if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
 13035  internal_error ("% are modified in local
context");
 13036if (ptr1->x_param_align_loop_iterations !=
ptr2->x_param_align_loop_iterations)
 13037  internal_error ("% are modified in local
context");
 13038if (ptr1->x_param_align_threshold != ptr2->x_param_align_threshold)
 13039  internal_error ("% are modified in local
context");
 13040if (ptr1->x_param_analyzer_bb_explosion_factor !=
ptr2->x_param_analyzer_bb_explosion_factor)
 13041  internal_error ("% are modified in local
context");
 13042if (ptr1->x_param_analyzer_max_constraints !=
ptr2->x_param_analyzer_max_constraints)
 13043  internal_error ("% are modified in local
context");

So the first test is failing.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #55 from Martin Liška  ---
> 
> with line numbers please :)

cat -n can do that

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #54 from Martin Liška  ---
(In reply to David Binderman from comment #53)
> (In reply to Martin Liška from comment #52)
> > > 2 | #pragma GCC pop_options
> > >   | ^~~
> > > 0xe8f7c3 cl_optimization_compare(gcc_options*, gcc_options*)
> > >   /home/dcb/gcc/working/gcc/options-save.c:13033
> > > 0x9b0ebd handle_pragma_pop_options
> > >   ../../trunk.git/gcc/c-family/c-pragma.c:1102
> > 
> > Thanks. Hm, still can't reproduce. Can please show me content at
> > gcc/options-save.c:13033 and lines around it?
> 
> void
> cl_optimization_compare (gcc_options *ptr1, gcc_options *ptr2)
> {
>   if (ptr1->x_help_flag != ptr2->x_help_flag)
> internal_error ("% are modified in local context");
>   if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
> internal_error ("% are modified in local context");
>   if (ptr1->x_param_align_loop_iterations !=
> ptr2->x_param_align_loop_iterations)
> internal_error ("% are modified in local context");
>   if (ptr1->x_param_align_threshold != ptr2->x_param_align_threshold)
> internal_error ("% are modified in local context");

with line numbers please :)

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #53 from David Binderman  ---
(In reply to Martin Liška from comment #52)
> > 2 | #pragma GCC pop_options
> >   | ^~~
> > 0xe8f7c3 cl_optimization_compare(gcc_options*, gcc_options*)
> > /home/dcb/gcc/working/gcc/options-save.c:13033
> > 0x9b0ebd handle_pragma_pop_options
> > ../../trunk.git/gcc/c-family/c-pragma.c:1102
> 
> Thanks. Hm, still can't reproduce. Can please show me content at
> gcc/options-save.c:13033 and lines around it?

void
cl_optimization_compare (gcc_options *ptr1, gcc_options *ptr2)
{
  if (ptr1->x_help_flag != ptr2->x_help_flag)
internal_error ("% are modified in local context");
  if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
internal_error ("% are modified in local context");
  if (ptr1->x_param_align_loop_iterations !=
ptr2->x_param_align_loop_iterations)
internal_error ("% are modified in local context");
  if (ptr1->x_param_align_threshold != ptr2->x_param_align_threshold)
internal_error ("% are modified in local context");

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #52 from Martin Liška  ---
> 2 | #pragma GCC pop_options
>   | ^~~
> 0xe8f7c3 cl_optimization_compare(gcc_options*, gcc_options*)
>   /home/dcb/gcc/working/gcc/options-save.c:13033
> 0x9b0ebd handle_pragma_pop_options
>   ../../trunk.git/gcc/c-family/c-pragma.c:1102

Thanks. Hm, still can't reproduce. Can please show me content at
gcc/options-save.c:13033 and lines around it?

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-02 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #51 from David Binderman  ---
(In reply to Martin Liška from comment #50)
> Thanks for it. For some reason, I can't still reproduce it. Please provide
> the output of -v option here.

Reading specs from /home/dcb/gcc/working/./gcc/specs
COLLECT_GCC=/home/dcb/gcc/working/./gcc/xgcc
Target: x86_64-pc-linux-gnu
Configured with: ../trunk.git/configure --prefix=/home/dcb/gcc/results.20210701
--disable-multilib --disable-werror --with-pkgversion=91c771ec8a3b6497
--enable-checking=df,extra,fold,rtl,yes --enabl
e-languages=c,c++,fortran
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.0.0 20210701 (experimental) (91c771ec8a3b6497) 
COLLECT_GCC_OPTIONS='-B' '/home/dcb/gcc/working/./gcc/' '-g' '-O3'
'-march=bdver2' '-c' '-v'
 /home/dcb/gcc/working/./gcc/cc1 -quiet -v -iprefix
/home/dcb/gcc/working/gcc/../lib/gcc/x86_64-pc-linux-gnu/12.0.0/ -isystem
/home/dcb/gcc/working/./gcc/include -isystem /home/dcb/gcc/working/./gcc
/include-fixed bug734.c -quiet -dumpbase bug734.c -dumpbase-ext .c
-march=bdver2 -g -O3 -version -o /tmp/ccfZi8wx.s
GNU C17 (91c771ec8a3b6497) version 12.0.0 20210701 (experimental)
(x86_64-pc-linux-gnu)
compiled by GNU C version 12.0.0 20210701 (experimental), GMP version
6.2.0, MPFR version 4.1.0-p11, MPC version 1.2.1, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/x86_64-pc-linux-gnu/12.0.0/include"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/x86_64-pc-linux-gnu/12.0.0/include-fixed"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/include"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/12.0.0/include"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/../../include"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/12.0.0/include-fixed"
ignoring nonexistent directory
"/home/dcb/gcc/working/gcc/../lib/gcc/../../lib/gcc/x86_64-pc-linux-gnu/12.0.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /home/dcb/gcc/working/./gcc/include
 /home/dcb/gcc/working/./gcc/include-fixed
 /usr/local/include
 /usr/include
End of search list.
GNU C17 (91c771ec8a3b6497) version 12.0.0 20210701 (experimental)
(x86_64-pc-linux-gnu)
compiled by GNU C version 12.0.0 20210701 (experimental), GMP version
6.2.0, MPFR version 4.1.0-p11, MPC version 1.2.1, isl version isl-0.16.1-GMP

GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: 9c0329e4bed137a737d23c2332823956
bug734.c:2:9: internal compiler error: ‘global_options’ are modified in local
context
2 | #pragma GCC pop_options
  | ^~~
0xe8f7c3 cl_optimization_compare(gcc_options*, gcc_options*)
/home/dcb/gcc/working/gcc/options-save.c:13033
0x9b0ebd handle_pragma_pop_options
../../trunk.git/gcc/c-family/c-pragma.c:1102

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #50 from Martin Liška  ---
(In reply to David Binderman from comment #49)
> Created attachment 51095 [details]
> C source code
> 
> Command line is
> 
> /home/dcb/gcc/working/./gcc/xgcc  -B/home/dcb/gcc/working/./gcc/  -g -O3
> -march
> =bdver2 -c bug734.c
> 
> and the reduced version of the code is
> 
> $ more bug734.c
> #pragma GCC push_options
> #pragma GCC pop_options
> $

Thanks for it. For some reason, I can't still reproduce it. Please provide the
output of -v option here.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #49 from David Binderman  ---
Created attachment 51095
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51095=edit
C source code

Command line is

/home/dcb/gcc/working/./gcc/xgcc  -B/home/dcb/gcc/working/./gcc/  -g -O3 -march
=bdver2 -c bug734.c

and the reduced version of the code is

$ more bug734.c
#pragma GCC push_options
#pragma GCC pop_options
$

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #48 from Martin Liška  ---
> -O3 fine. Looks like an march=bdver2 issue.

All right, so please attach me here the pre-processed source file. I tried
doing that myself (using -O3 -march=bdver2), but it was fine (for some reason).

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #47 from David Binderman  ---
(In reply to David Binderman from comment #46)
> (In reply to David Binderman from comment #43)
> > Rebroken, this time during bootstrap, so much more serious.
> 
> > I'll have a go at dropping the -O3 -march=native back downto
> > -O2 and see what happens.
> 
> -O2 fine. I'll try -O3 without the -march=native.

-O3 fine. Looks like an march=bdver2 issue.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #46 from David Binderman  ---
(In reply to David Binderman from comment #43)
> Rebroken, this time during bootstrap, so much more serious.

> I'll have a go at dropping the -O3 -march=native back downto
> -O2 and see what happens.

-O2 fine. I'll try -O3 without the -march=native.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #45 from David Binderman  ---
(In reply to Martin Liška from comment #44)
> What CPU do you have? 

AMD FX-8350. 

> What -march=native expands to (-v argument). 

bdver2

> Can you please attach the pre-processed source file.

 I'll let you know when I have it again.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread marxin at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #44 from Martin Liška  ---
(In reply to David Binderman from comment #43)
> Rebroken, this time during bootstrap, so much more serious.
> 
> /home/dcb/gcc/working/./gcc/xgcc -B/home/dcb/gcc/working/./gcc/
> -B/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/bin/
> -B/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/lib/ -isystem
> /home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/include -isystem
> /home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/sys-include  
> -fchecking=1 -g -O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W
> -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
> -Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
> -Wold-style-definition  -isystem ./include  -fpic -mlong-double-80
> -DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
> -fno-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER
> -fcf-protection -mshstk -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
> -I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
> -I../../../trunk.git/libgcc/../include
> -I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
> -DHAVE_CC_TLS  -DUSE_TLS -o _cmpdi2_s.o -MT _cmpdi2_s.o -MD -MP -MF
> _cmpdi2_s.dep -DSHARED -DL_cmpdi2 -c ../../../trunk.git/libgcc/libgcc2.c
> In file included from /home/dcb/gcc/working/gcc/include/x86gprintrin.h:37,
>  from
> ../../../trunk.git/libgcc/config/i386/shadow-stack-unwind.h:25,
>  from ./md-unwind-support.h:27,
>  from ../../../trunk.git/libgcc/unwind-dw2.c:412:
> /home/dcb/gcc/working/gcc/include/bmi2intrin.h:106:9: internal compiler
> error: ‘global_options’ are modified in local context
>   106 | #pragma GCC pop_options
>   | ^~~
> 
> Configure lines are:
> 
> ../trunk.git/configure --prefix=/home/dcb/gcc/$PREFIX \
>   --disable-multilib \
>   --disable-werror \
>   --with-pkgversion=$HASH \
>   --enable-checking=df,extra,fold,rtl,yes \
>   --enable-languages=c,c++,fortran,d,go
> 
> sed 's/-O2/-O3 -march=native/' < Makefile > Makefile.tmp
> diff Makefile Makefile.tmp
> mv Makefile.tmp Makefile
> 
> I'll have a go at dropping the -O3 -march=native back downto
> -O2 and see what happens.

What CPU do you have? What -march=native expands to (-v argument). Can you
please attach the pre-processed source file.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-07-01 Thread dcb314 at hotmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #43 from David Binderman  ---
Rebroken, this time during bootstrap, so much more serious.

/home/dcb/gcc/working/./gcc/xgcc -B/home/dcb/gcc/working/./gcc/
-B/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/bin/
-B/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/lib/ -isystem
/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/include -isystem
/home/dcb/gcc/results.20210701/x86_64-pc-linux-gnu/sys-include   -fchecking=1
-g -O3 -march=native -O2  -g -O3 -march=native -DIN_GCC-W -Wall
-Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-error=format-diag
-Wstrict-prototypes -Wmissing-prototypes -Wno-error=format-diag
-Wold-style-definition  -isystem ./include  -fpic -mlong-double-80
-DUSE_ELF_SYMVER -fcf-protection -mshstk -g -DIN_LIBGCC2 -fbuilding-libgcc
-fno-stack-protector  -fpic -mlong-double-80 -DUSE_ELF_SYMVER -fcf-protection
-mshstk -I. -I. -I../.././gcc -I../../../trunk.git/libgcc
-I../../../trunk.git/libgcc/. -I../../../trunk.git/libgcc/../gcc
-I../../../trunk.git/libgcc/../include
-I../../../trunk.git/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT
-DHAVE_CC_TLS  -DUSE_TLS -o _cmpdi2_s.o -MT _cmpdi2_s.o -MD -MP -MF
_cmpdi2_s.dep -DSHARED -DL_cmpdi2 -c ../../../trunk.git/libgcc/libgcc2.c
In file included from /home/dcb/gcc/working/gcc/include/x86gprintrin.h:37,
 from
../../../trunk.git/libgcc/config/i386/shadow-stack-unwind.h:25,
 from ./md-unwind-support.h:27,
 from ../../../trunk.git/libgcc/unwind-dw2.c:412:
/home/dcb/gcc/working/gcc/include/bmi2intrin.h:106:9: internal compiler error:
‘global_options’ are modified in local context
  106 | #pragma GCC pop_options
  | ^~~

Configure lines are:

../trunk.git/configure --prefix=/home/dcb/gcc/$PREFIX \
--disable-multilib \
--disable-werror \
--with-pkgversion=$HASH \
--enable-checking=df,extra,fold,rtl,yes \
--enable-languages=c,c++,fortran,d,go

sed 's/-O2/-O3 -march=native/' < Makefile > Makefile.tmp
diff Makefile Makefile.tmp
mv Makefile.tmp Makefile

I'll have a go at dropping the -O3 -march=native back downto
-O2 and see what happens.

[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute

2021-05-25 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860

--- Comment #42 from CVS Commits  ---
The master branch has been updated by Martin Liska :

https://gcc.gnu.org/g:ebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e

commit r12-1039-gebd5e86c0f41dc1d692f9b2b68a510b1f6835a3e
Author: Martin Liska 
Date:   Wed Mar 10 15:12:31 2021 +0100

Improve global state for options.

gcc/c-family/ChangeLog:

PR tree-optimization/92860
PR target/99592
* c-attribs.c (handle_optimize_attribute): Save target node
before calling parse_optimize_options and save it in case
it changes.
* c-pragma.c (handle_pragma_target): Similarly for pragma.
(handle_pragma_pop_options): Likewise here.

gcc/ChangeLog:

PR tree-optimization/92860
PR target/99592
* optc-save-gen.awk: Remove exceptions.