public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "dcb314 at hotmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/92860] [9/10/11/12 regression] Global flags affected by -O settings are clobbered by optimize attribute
Date: Tue, 14 Dec 2021 09:35:29 +0000	[thread overview]
Message-ID: <bug-92860-4-AI0olBNjdn@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-92860-4@http.gcc.gnu.org/bugzilla/>

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 (

  parent reply	other threads:[~2021-12-14  9:35 UTC|newest]

Thread overview: 84+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-92860-4@http.gcc.gnu.org/bugzilla/>
2020-03-17 17:06 ` [Bug tree-optimization/92860] [8/9/10 " marxin at gcc dot gnu.org
2020-03-18 10:57 ` marxin at gcc dot gnu.org
2020-04-01  8:08 ` rguenth at gcc dot gnu.org
2020-05-07 11:56 ` [Bug tree-optimization/92860] [8/9/10/11 " jakub at gcc dot gnu.org
2020-05-25 17:30 ` marxin at gcc dot gnu.org
2020-05-29 18:27 ` egallager at gcc dot gnu.org
2020-05-29 19:30 ` segher at gcc dot gnu.org
2020-05-29 21:36 ` egallager at gcc dot gnu.org
2020-06-10  8:07 ` cvs-commit at gcc dot gnu.org
2020-06-10  8:24 ` marxin at gcc dot gnu.org
2020-06-11 10:19 ` dcb314 at hotmail dot com
2020-06-24  7:33 ` marxin at gcc dot gnu.org
2020-06-24  7:41 ` marxin at gcc dot gnu.org
2020-06-24  8:39 ` dcb314 at hotmail dot com
2020-06-24  8:42 ` marxin at gcc dot gnu.org
2020-06-24  8:53 ` dcb314 at hotmail dot com
2020-06-24  8:56 ` marxin at gcc dot gnu.org
2020-06-24  9:27 ` dcb314 at hotmail dot com
2020-06-24  9:29 ` marxin at gcc dot gnu.org
2020-06-24 20:54 ` dcb314 at hotmail dot com
2020-06-25  6:31 ` marxin at gcc dot gnu.org
2020-06-25  6:32 ` marxin at gcc dot gnu.org
2020-06-25  6:54 ` dcb314 at hotmail dot com
2020-06-25  6:59 ` marxin at gcc dot gnu.org
2020-07-06  4:09 ` asolokha at gmx dot com
2020-07-07  7:21 ` marxin at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2020-12-11 10:30 ` marxin at gcc dot gnu.org
2021-03-16 13:45 ` marxin at gcc dot gnu.org
2021-03-16 20:21 ` arnd at linaro dot org
2021-05-04 12:32 ` [Bug tree-optimization/92860] [8/9/10/11/12 " rguenth at gcc dot gnu.org
2021-05-25 12:57 ` [Bug tree-optimization/92860] [9/10/11/12 " cvs-commit at gcc dot gnu.org
2021-07-01  8:54 ` dcb314 at hotmail dot com
2021-07-01  9:11 ` marxin at gcc dot gnu.org
2021-07-01 14:11 ` dcb314 at hotmail dot com
2021-07-01 15:38 ` dcb314 at hotmail dot com
2021-07-01 17:45 ` dcb314 at hotmail dot com
2021-07-01 18:51 ` marxin at gcc dot gnu.org
2021-07-01 19:34 ` dcb314 at hotmail dot com
2021-07-02  4:16 ` marxin at gcc dot gnu.org
2021-07-02  6:30 ` dcb314 at hotmail dot com
2021-07-02  7:04 ` marxin at gcc dot gnu.org
2021-07-02  7:12 ` dcb314 at hotmail dot com
2021-07-02  7:18 ` marxin at gcc dot gnu.org
2021-07-02  7:20 ` marxin at gcc dot gnu.org
2021-07-02  7:35 ` dcb314 at hotmail dot com
2021-07-02  7:48 ` marxin at gcc dot gnu.org
2021-07-02 20:16 ` dcb314 at hotmail dot com
2021-08-16 11:45 ` marxin at gcc dot gnu.org
2021-12-09 14:02 ` marxin at gcc dot gnu.org
2021-12-09 18:46 ` dcb314 at hotmail dot com
2021-12-09 18:48 ` dcb314 at hotmail dot com
2021-12-10  9:09 ` marxin at gcc dot gnu.org
2021-12-11 21:15 ` dcb314 at hotmail dot com
2021-12-11 22:24 ` dcb314 at hotmail dot com
2021-12-12 12:52 ` dcb314 at hotmail dot com
2021-12-13  6:28 ` asolokha at gmx dot com
2021-12-13 10:04 ` marxin at gcc dot gnu.org
2021-12-13 10:05 ` marxin at gcc dot gnu.org
2021-12-13 10:14 ` dcb314 at hotmail dot com
2021-12-13 12:52 ` marxin at gcc dot gnu.org
2021-12-14  9:35 ` dcb314 at hotmail dot com [this message]
2021-12-14 10:01 ` marxin at gcc dot gnu.org
2021-12-14 11:11 ` asolokha at gmx dot com
2021-12-14 14:12 ` dcb314 at hotmail dot com
2021-12-14 15:34 ` marxin at gcc dot gnu.org
2022-01-03 10:26 ` rguenther at suse dot de
2022-01-03 22:22 ` dcb314 at hotmail dot com
2022-01-03 22:32 ` dcb314 at hotmail dot com
2022-01-04  7:43 ` rguenther at suse dot de
2022-01-04  8:35 ` marxin at gcc dot gnu.org
2022-01-04 11:14 ` dcb314 at hotmail dot com
2022-01-04 11:19 ` dcb314 at hotmail dot com
2022-01-04 13:51 ` marxin at gcc dot gnu.org
2022-01-04 13:52 ` marxin at gcc dot gnu.org
2022-01-04 17:27 ` marxin at gcc dot gnu.org
2022-01-04 17:29 ` marxin at gcc dot gnu.org
2022-01-04 17:43 ` marxin at gcc dot gnu.org
2022-01-04 18:43 ` marxin at gcc dot gnu.org
2022-01-04 19:31 ` marxin at gcc dot gnu.org
2022-01-05 14:43 ` marxin at gcc dot gnu.org
2022-01-05 19:14 ` ubizjak at gmail dot com
2022-01-06 14:57 ` dcb314 at hotmail dot com
2024-03-27  0:54 ` pinskia at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-92860-4-AI0olBNjdn@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).