[Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute
dcb314 at hotmail dot com
gcc-bugzilla@gcc.gnu.org
Tue Dec 14 09:35:29 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92860
--- Comment #71 from David Binderman <dcb314 at hotmail dot com> ---
(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 {
> > 13032 if (ptr1->x_help_flag != ptr2->x_help_flag)
> > 13033 internal_error ("%<global_options%> are modified in local
> > context");
> > 13034 if (ptr1->x_no_sysroot_suffix != ptr2->x_no_sysroot_suffix)
> > 13035 internal_error ("%<global_options%> are modified in local
> > context");
> > 13036 if (ptr1->x_param_align_loop_iterations !=
> > ptr2->x_param_align_loop_iterations)
> > 13037 internal_error ("%<global_options%> are modified in local
> > context");
> > 13038 if (ptr1->x_param_align_threshold != ptr2->x_param_align_threshold)
> > 13039 internal_error ("%<global_options%> are modified in local
> > context");
> > 13040 if (ptr1->x_param_analyzer_bb_explosion_factor !=
> > ptr2->x_param_analyzer_bb_explosion_factor)
> > 13041 internal_error ("%<global_options%> are modified in local
> > context");
> > 13042 if (ptr1->x_param_analyzer_max_constraints !=
> > ptr2->x_param_analyzer_max_constraints)
> > 13043 internal_error ("%<global_options%> 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 &ptr1->x_help_flag
> $3 = (int *) 0x26c87d0
> (gdb) watch *$3
> Hardware watchpoint 4: *$3
> (gdb) r
> Old value = <unreadable>
> New value = 0
> handle_pragma_push_options (dummy=<optimized out>) 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 0x00007ffff76d815b in _int_realloc (
av=av@entry=0x7ffff7835aa0 <main_arena>, oldp=oldp@entry=0x2e75f10,
oldsize=14624, nb=nb@entry=21920) at malloc.c:4786
#2 0x00007ffff76d8f49 in __GI___libc_realloc (oldmem=0x2e75f20, bytes=21912)
at malloc.c:3372
#3 0x0000000001e09e0e in xrealloc (oldmem=0x2e7bc70, size=21912)
at ../../trunk.git/libiberty/xmalloc.c:181
#4 0x00000000007b91dd in va_heap::reserve<finalizer> (v=<optimized out>,
reserve=<optimized out>, exact=<optimized out>)
at ../../trunk.git/gcc/vec.h:290
#5 vec<finalizer, va_heap, vl_ptr>::reserve (this=0x2df6ca8, nelems=1,
exact=false) at ../../trunk.git/gcc/vec.h:1858
#6 vec<finalizer, va_heap, vl_ptr>::safe_push (this=0x2df6ca8, obj=...)
at ../../trunk.git/gcc/vec.h:1967
#7 0x00000000007b65a4 in add_finalizer (result=0x7fffe9f75270,
f=0x691dc0 <finalize<c_binding>(void*)>, s=0, n=1)
at ../../trunk.git/gcc/ggc-page.c:1264
#8 ggc_internal_alloc (size=<optimized out>, size@entry=48,
f=0x691dc0 <finalize<c_binding>(void*)>, s=s@entry=0, n=n@entry=1)
at ../../trunk.git/gcc/ggc-page.c:1421
#9 0x000000000066f18d in ggc_alloc<c_binding> ()
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 0x00000000006774d4 in c_builtin_function (decl=0x7fffe9f76000)
at ../../trunk.git/gcc/c/c-decl.c:4585
#12 0x0000000000750d62 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=<optimized out>, nonansi_p=true, fnattrs=0x7fffe9f50398,
implicit_p=false) at ../../trunk.git/gcc/c-family/c-common.c:4923
#13 0x000000000072b118 in c_define_builtins (
More information about the Gcc-bugs
mailing list