public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <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, 04 Jan 2022 17:27:00 +0000	[thread overview]
Message-ID: <bug-92860-4-TAkRpfmspW@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 #85 from Martin Liška <marxin at gcc dot gnu.org> ---
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 [0xffffffffffffff80]) 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 [0xffffffffffffff80]) repeated x4
             ])
         (nil)))

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

  parent reply	other threads:[~2022-01-04 17:27 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
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 [this message]
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-TAkRpfmspW@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).