public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hjl.tools at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
Date: Tue, 25 Nov 2014 18:23:00 -0000	[thread overview]
Message-ID: <bug-64037-4-6SJCUrl4c9@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-64037-4@http.gcc.gnu.org/bugzilla/>

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

H.J. Lu <hjl.tools at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Miscompilation with -Os and |[4.8/4.9/5 Regression]
                   |enum class : char parameter |Miscompilation with -Os and
                   |                            |enum class : char parameter

--- Comment #13 from H.J. Lu <hjl.tools at gmail dot com> ---
The bug was introduced by

https://gcc.gnu.org/ml/gcc-cvs/2007-09/msg00613.html

commit 5d93234932c3d8617ce92b77b7013ef6bede9508
Author: shinwell <shinwell@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Thu Sep 20 11:01:18 2007 +0000

      gcc/
      * combine.c: Include cgraph.h.
      (setup_incoming_promotions): Rework to allow more aggressive
      elimination of sign extensions when all call sites of the
      current function are known to lie within the current unit.


    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@128618
138bc75d-0d04-0410-961f-82ee72b054a4

Before this commit, combine.c has

          enum machine_mode mode = TYPE_MODE (TREE_TYPE (arg));
          int uns = TYPE_UNSIGNED (TREE_TYPE (arg));

          mode = promote_mode (TREE_TYPE (arg), mode, &uns, 1);
          if (mode == GET_MODE (reg) && mode != DECL_MODE (arg))
            {
              rtx x;
              x = gen_rtx_CLOBBER (DECL_MODE (arg), const0_rtx);
              x = gen_rtx_fmt_e ((uns ? ZERO_EXTEND : SIGN_EXTEND), mode, x);
              record_value_for_reg (reg, first, x);
            }

It matches function.c:

  /* This is not really promoting for a call.  However we need to be
     consistent with assign_parm_find_data_types and expand_expr_real_1.  */
  promoted_nominal_mode
    = promote_mode (data->nominal_type, data->nominal_mode, &unsignedp, 1);

128618 changed

mode = promote_mode (TREE_TYPE (arg), mode, &uns, 1);

to

mode3 = promote_mode (DECL_ARG_TYPE (arg), mode2, &uns3, 1);

It breaks none WORD_REGISTER_OPERATIONS targets.


  parent reply	other threads:[~2014-11-25 18:23 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO " js at alien8 dot de
2014-11-23 23:08 ` [Bug c++/64037] " js at alien8 dot de
2014-11-23 23:08 ` js at alien8 dot de
2014-11-23 23:09 ` js at alien8 dot de
2014-11-23 23:15 ` [Bug target/64037] " pinskia at gcc dot gnu.org
2014-11-24 11:13 ` rguenth at gcc dot gnu.org
2014-11-24 17:48 ` hjl.tools at gmail dot com
2014-11-24 17:49 ` pinskia at gcc dot gnu.org
2014-11-24 19:25 ` [Bug rtl-optimization/64037] " hjl.tools at gmail dot com
2014-11-24 19:52 ` hjl.tools at gmail dot com
2014-11-24 21:33 ` hjl.tools at gmail dot com
2014-11-24 21:39 ` hjl.tools at gmail dot com
2014-11-24 21:40 ` hjl.tools at gmail dot com
2014-11-25 18:23 ` hjl.tools at gmail dot com [this message]
2014-11-28 15:28 ` [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os " hjl at gcc dot gnu.org
2014-11-28 15:32 ` [Bug rtl-optimization/64037] [4.8/4.9 " hjl.tools at gmail dot com
2014-12-05 11:48 ` hjl at gcc dot gnu.org
2014-12-05 12:03 ` hjl at gcc dot gnu.org
2014-12-05 12:07 ` hjl.tools at gmail dot com
2014-12-09 14:35 ` uros at gcc dot gnu.org
2014-12-09 14:41 ` uros at gcc dot gnu.org
2014-12-09 14:44 ` uros at gcc dot gnu.org
2014-12-09 14:48 ` [Bug rtl-optimization/64037] [4.8/4.9/5 " ubizjak at gmail dot com
2014-12-10 13:22 ` rguenth at gcc dot gnu.org
2014-12-14 16:04 ` hjl at gcc dot gnu.org
2014-12-14 16:07 ` hjl at gcc dot gnu.org
2014-12-15 16:01 ` hjl.tools at gmail dot com
2014-12-19 13:40 ` jakub at gcc dot gnu.org
2014-12-19 19:20 ` hjl at gcc dot gnu.org
2014-12-19 19:49 ` hjl.tools at gmail dot com

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-64037-4-6SJCUrl4c9@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).