public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter
@ 2014-11-23 23:07 js at alien8 dot de
  2014-11-23 23:08 ` [Bug c++/64037] " js at alien8 dot de
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: js at alien8 dot de @ 2014-11-23 23:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64037
           Summary: Miscompilation with LTO and enum class : char
                    parameter
           Product: gcc
           Version: 4.9.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: js at alien8 dot de

Created attachment 34082
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34082&action=edit
Minimal test case

On Linux with the x86-64 target, code that contains a byte-sized enum class as
a function parameter is miscompiled when -Os and -flto is enabled. A minimal
example is attached. I also attached g++ --verbose --version output for both
compilers where this triggers (4.9.1 and 4.9.2).

To reproduce the problem compile the attached source with:
g++ -std=gnu++11 -Os -flto test.cc -o test

Run ./test and you get this output: deadbe02
Expected output: 00000002

The problem boils down to the fact that the third parameter to foo (see below)
is passed in DL (the rest of RDX is not cleared). In the function, no code is
emitted to clear the rest of RDX, but it is obviously assumed to be zero.

enum class X : unsigned char {
  V = 2,
};

// noinline and noclone are only there to reduce the example. This
// also triggers without these annotations in larger projects.
void foo(unsigned &out, unsigned a, X b) __attribute__((noinline,noclone));

void foo(unsigned &out, unsigned a, X b)
{
  out = static_cast<unsigned>(b);
}

int main()
{
  // Load obvious value into EDX
  unsigned deadbeef = 0xDEADBEEF;
  asm volatile ("" : "+d" (deadbeef));

  unsigned out;
  foo(out, 2, X::V);
...

0000000000400500 <main>:
  400500:    48 83 ec 18              sub    rsp,0x18
  400504:    ba ef be ad de           mov    edx,0xdeadbeef  <- EDX is loaded
with some garbage
  400509:    48 8d 7c 24 0c           lea    rdi,[rsp+0xc]
  40050e:    b2 02                    mov    dl,0x2          <- Parameter is
put in DL, without clearing RDX first
  400510:    be 02 00 00 00           mov    esi,0x2
  400515:    e8 0c 01 00 00           call   400626 <foo(unsigned int&,
unsigned int, X)>


0000000000400626 <foo(unsigned int&, unsigned int, X)>:
  400626:    89 17                    mov    DWORD PTR [rdi],edx  <- EDX still
contains remnants of 0xDEADBEEF here!
  400628:    c3                       ret


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug c++/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
@ 2014-11-23 23:08 ` js at alien8 dot de
  2014-11-23 23:08 ` js at alien8 dot de
                   ` (27 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: js at alien8 dot de @ 2014-11-23 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Julian Stecklina <js at alien8 dot de> ---
Created attachment 34083
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34083&action=edit
gcc --verbose --version for 4.9.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug c++/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter 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
                   ` (26 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: js at alien8 dot de @ 2014-11-23 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Julian Stecklina <js at alien8 dot de> ---
Created attachment 34084
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34084&action=edit
gcc --verbose --version for 4.9.2


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug c++/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter 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
                   ` (25 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: js at alien8 dot de @ 2014-11-23 23:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Julian Stecklina <js at alien8 dot de> ---
Created attachment 34085
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34085&action=edit
Miscompiled binary (built with 4.9.2)


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug target/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (2 preceding siblings ...)
  2014-11-23 23:09 ` js at alien8 dot de
@ 2014-11-23 23:15 ` pinskia at gcc dot gnu.org
  2014-11-24 11:13 ` rguenth at gcc dot gnu.org
                   ` (24 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-23 23:15 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*
          Component|c++                         |target

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This sounds like the target is expanding the two sides of the function call foo
inconsistent with each other.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug target/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (3 preceding siblings ...)
  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
                   ` (23 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-11-24 11:13 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ABI, wrong-code
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2014-11-24
     Ever confirmed|0                           |1
      Known to fail|                            |4.8.2, 4.9.2

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Same issue without -flto but just -Os -fwhole-program.  Can also reproduced
with just -Os when making 'foo' static.

Confirmed.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug target/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (4 preceding siblings ...)
  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
                   ` (22 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|x86_64-*-*                  |

--- Comment #6 from H.J. Lu <hjl.tools at gmail dot com> ---
It also happens with -m32.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug target/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (5 preceding siblings ...)
  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
                   ` (21 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-11-24 17:49 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|                            |x86_64-*-*, i?86-*-*

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #6)
> It also happens with -m32.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (6 preceding siblings ...)
  2014-11-24 17:49 ` pinskia at gcc dot gnu.org
@ 2014-11-24 19:25 ` hjl.tools at gmail dot com
  2014-11-24 19:52 ` hjl.tools at gmail dot com
                   ` (20 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 19:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |rtl-optimization
   Target Milestone|---                         |4.9.3

--- Comment #8 from H.J. Lu <hjl.tools at gmail dot com> ---
On x86, we don't require promoting QI/HI argument to SI.
Depending on optimization choice, we may generate SI move
for QI argument:

    movl    $2, %ecx    # 9    *movqi_internal/2    [length = 5]

For -Os, we generate:

    movb    $2, %cl    # 9    *movqi_internal/2    [length = 2]

since movb is shorter.  It is a pure luck that it only fails with -Os.
The combine pass turns

(insn 2 7 4 2 (set (reg/v/f:SI 88 [ out ])
        (reg:SI 0 ax [ out ])) ../pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 0 ax [ out ])
        (nil)))
(insn 4 2 6 2 (set (reg:SI 91 [ b ])
        (reg:SI 2 cx [ b ])) ../pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 2 cx [ b ])
        (nil)))
(note 6 4 9 2 NOTE_INSN_FUNCTION_BEG)
(insn 9 6 10 2 (set (reg:SI 92 [ b ])
        (zero_extend:SI (subreg:QI (reg:SI 91 [ b ]) 0))) ../pr64037.ii:9 138
{*
zero_extendqisi2}
     (expr_list:REG_DEAD (reg:SI 91 [ b ])
        (nil)))
(insn 10 9 0 2 (set (mem:SI (reg/v/f:SI 88 [ out ]) [1 *out_4(D)+0 S4 A32])
        (reg:SI 92 [ b ])) ../pr64037.ii:9 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 92 [ b ])
        (expr_list:REG_DEAD (reg/v/f:SI 88 [ out ])
            (nil))))

into

(insn 2 7 4 2 (set (reg/v/f:SI 88 [ out ])
        (reg:SI 0 ax [ out ])) pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 0 ax [ out ])
        (nil)))
(insn 4 2 6 2 (set (reg:SI 91 [ b ])
        (reg:SI 2 cx [ b ])) pr64037.ii:8 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 2 cx [ b ])
        (nil)))
(note 6 4 9 2 NOTE_INSN_FUNCTION_BEG)
(note 9 6 10 2 NOTE_INSN_DELETED)
(insn 10 9 0 2 (set (mem:SI (reg/v/f:SI 88 [ out ]) [1 *out_4(D)+0 S4 A32])
        (reg:SI 91 [ b ])) pr64037.ii:9 90 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 91 [ b ])
        (expr_list:REG_DEAD (reg/v/f:SI 88 [ out ])
            (nil))))

It is certainly wrong.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (7 preceding siblings ...)
  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
                   ` (19 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 19:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from H.J. Lu <hjl.tools at gmail dot com> ---
This may fail on all targets where WORD_REGISTER_OPERATIONS isn't defined.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (8 preceding siblings ...)
  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
                   ` (18 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 21:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu.org

--- Comment #10 from H.J. Lu <hjl.tools at gmail dot com> ---
To pass

enum class X : unsigned char {
  V = 2,
};

assign_parm_setup_reg calls ix86_promote_function_mode

(gdb) f 0
#0  ix86_promote_function_mode (type=0x7ffff19f85e8, mode=QImode, 
    punsignedp=0x7fffffffd3c4, fntype=0x7ffff19f8738, for_return=2)
    at /export/gnu/import/git/gcc/gcc/config/i386/i386.c:8310
8310      if (type != NULL_TREE && POINTER_TYPE_P (type))
(gdb) call debug_tree (type)
 <enumeral_type 0x7ffff19f85e8 X
    type <integer_type 0x7ffff18a93f0 unsigned char public unsigned string-flag
QI
        size <integer_cst 0x7ffff18a5fa8 constant 8>
        unit size <integer_cst 0x7ffff18a5fc0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x7ffff18a93f0 precision 8
min <integer_cst 0x7ffff18a5fd8 0> max <integer_cst 0x7ffff18a5f78 255>>
    static unsigned type_5 QI size <integer_cst 0x7ffff18a5fa8 8> unit size
<integer_cst 0x7ffff18a5fc0 1>
    align 8 symtab 0 alias set -1 canonical type 0x7ffff19f85e8 precision 8 min
<integer_cst 0x7ffff18a5fd8 0> max <integer_cst 0x7ffff18a5f78 255>
    values <tree_list 0x7ffff19fb028
        purpose <identifier_node 0x7ffff19f6738 V
            bindings <(nil)>
            local bindings <(nil)>>
        value <const_decl 0x7ffff18c21c0 V type <enumeral_type 0x7ffff19f85e8
X>
            readonly constant used VOID file pr64037.ii line 2 col 3
            align 1 context <enumeral_type 0x7ffff19f85e8 X> initial
<integer_cst 0x7ffff19d8d08 2>>> context <translation_unit_decl 0x7ffff7ff91e0
D.1>
    chain <type_decl 0x7ffff19f5c78 X>>
(gdb) 

However, setup_incoming_promotions calls ix86_promote_function_mode with

Breakpoint 18, ix86_promote_function_mode (type=0x7ffff18a9690, mode=SImode, 
    punsignedp=0x7fffffffd774, fntype=0x7ffff19f8738, for_return=0)
    at /export/gnu/import/git/gcc/gcc/config/i386/i386.c:8310
8310      if (type != NULL_TREE && POINTER_TYPE_P (type))
(gdb) call debug_tree (type)
 <integer_type 0x7ffff18a9690 int public SI
    size <integer_cst 0x7ffff18a5e70 type <integer_type 0x7ffff18a9150
bitsizetype> constant 32>
    unit size <integer_cst 0x7ffff18a5e88 type <integer_type 0x7ffff18a90a8
sizetype> constant 4>
    align 32 symtab 0 alias set 1 canonical type 0x7ffff18a9690 precision 32
min <integer_cst 0x7ffff18c60c0 -2147483648> max <integer_cst 0x7ffff18c60d8
2147483647>
    pointer_to_this <pointer_type 0x7ffff18cb930>>
(gdb) 

It uses a different type and mode.

If I make this change to combine:

diff --git a/gcc/combine.c b/gcc/combine.c
index 1808f97..8bdfe2b 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -1562,7 +1562,7 @@ setup_incoming_promotions (rtx_insn *first)

       /* The mode and signedness of the argument as it is actually passed,
          after any TARGET_PROMOTE_FUNCTION_ARGS-driven ABI promotions.  */
-      mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode2, &uns3,
+      mode3 = promote_function_mode (DECL_ARG_TYPE (arg), mode1, &uns1,
                 TREE_TYPE (cfun->decl), 0);

to make setup_incoming_promotions consistent with assign_parm_setup_reg,
the testcase works.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (9 preceding siblings ...)
  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
                   ` (17 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 21:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ubizjak at gmail dot com

--- Comment #11 from H.J. Lu <hjl.tools at gmail dot com> ---
i386.c has

#define TARGET_PROMOTE_PROTOTYPES hook_bool_const_tree_true

 -- Target Hook: bool TARGET_PROMOTE_PROTOTYPES (const_tree FNTYPE)
     This target hook returns 'true' if an argument declared in a
     prototype as an integral type smaller than 'int' should actually be
     passed as an 'int'.  In addition to avoiding errors in certain
     cases of mismatch, it also makes for better code on certain
     machines.  The default is to not promote prototypes.

But it uses movq to pass a QI parameter.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] Miscompilation with LTO and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (10 preceding siblings ...)
  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 ` [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os " hjl.tools at gmail dot com
                   ` (16 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-24 21:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from H.J. Lu <hjl.tools at gmail dot com> ---
Here is the related discussion:

https://groups.google.com/forum/#!topic/ia32-abi/9H4BBrIdkmk


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (11 preceding siblings ...)
  2014-11-24 21:40 ` hjl.tools at gmail dot com
@ 2014-11-25 18:23 ` hjl.tools at gmail dot com
  2014-11-28 15:28 ` hjl at gcc dot gnu.org
                   ` (15 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-25 18:23 UTC (permalink / raw)
  To: gcc-bugs

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.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (12 preceding siblings ...)
  2014-11-25 18:23 ` [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os " hjl.tools at gmail dot com
@ 2014-11-28 15:28 ` 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
                   ` (14 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-11-28 15:28 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Fri Nov 28 15:27:55 2014
New Revision: 218161

URL: https://gcc.gnu.org/viewcvs?rev=218161&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

gcc/

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/pr64037.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (13 preceding siblings ...)
  2014-11-28 15:28 ` hjl at gcc dot gnu.org
@ 2014-11-28 15:32 ` hjl.tools at gmail dot com
  2014-12-05 11:48 ` hjl at gcc dot gnu.org
                   ` (13 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-11-28 15:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|4.9.2                       |4.8.4
   Target Milestone|4.9.3                       |4.8.4
            Summary|[4.8/4.9/5 Regression]      |[4.8/4.9 Regression]
                   |Miscompilation with -Os and |Miscompilation with -Os and
                   |enum class : char parameter |enum class : char parameter

--- Comment #15 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed on trunk so far.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (14 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-05 11:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Fri Dec  5 11:47:51 2014
New Revision: 218418

URL: https://gcc.gnu.org/viewcvs?rev=218418&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

gcc/

    Backport from mainline
    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    Backport from mainline
    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/combine.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (15 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-05 12:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Fri Dec  5 12:02:33 2014
New Revision: 218420

URL: https://gcc.gnu.org/viewcvs?rev=218420&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

gcc/

    Backport from mainline
    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    Backport from mainline
    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/combine.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (16 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-12-05 12:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #18 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for 4.8.4 and 4.9.3.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (17 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: uros at gcc dot gnu.org @ 2014-12-09 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #20 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Dec  9 14:34:32 2014
New Revision: 218516

URL: https://gcc.gnu.org/viewcvs?rev=218516&root=gcc&view=rev
Log:
    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

testsuite/ChangeLog:

    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.


Removed:
    trunk/gcc/testsuite/g++.dg/pr64037.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (18 preceding siblings ...)
  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
                   ` (8 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: uros at gcc dot gnu.org @ 2014-12-09 14:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #21 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Dec  9 14:40:40 2014
New Revision: 218517

URL: https://gcc.gnu.org/viewcvs?rev=218517&root=gcc&view=rev
Log:
    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

testsuite/ChangeLog:

    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.


Removed:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/combine.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (19 preceding siblings ...)
  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
                   ` (7 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: uros at gcc dot gnu.org @ 2014-12-09 14:44 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #22 from uros at gcc dot gnu.org ---
Author: uros
Date: Tue Dec  9 14:44:06 2014
New Revision: 218518

URL: https://gcc.gnu.org/viewcvs?rev=218518&root=gcc&view=rev
Log:
    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

testsuite/ChangeLog:

    PR bootstrap/64213
    Revert:
    2014-11-28  H.J. Lu  <hongjiu.lu@intel.com>

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.


Removed:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/combine.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (20 preceding siblings ...)
  2014-12-09 14:44 ` uros at gcc dot gnu.org
@ 2014-12-09 14:48 ` ubizjak at gmail dot com
  2014-12-10 13:22 ` rguenth at gcc dot gnu.org
                   ` (6 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: ubizjak at gmail dot com @ 2014-12-09 14:48 UTC (permalink / raw)
  To: gcc-bugs

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

Uroš Bizjak <ubizjak at gmail dot com> changed:

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

--- Comment #23 from Uroš Bizjak <ubizjak at gmail dot com> ---
Reopening due to revert on all branches.
>From gcc-bugs-return-469903-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Tue Dec 09 14:49:09 2014
Return-Path: <gcc-bugs-return-469903-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 13462 invoked by alias); 9 Dec 2014 14:49:09 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 13146 invoked by uid 48); 9 Dec 2014 14:49:02 -0000
From: "trippels at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/64237] [5 Regression] glibc build failure
Date: Tue, 09 Dec 2014 14:49:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: target
X-Bugzilla-Version: 5.0
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: trippels at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Priority: P1
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: 5.0
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-64237-4-oeELarUBQP@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-64237-4@http.gcc.gnu.org/bugzilla/>
References: <bug-64237-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2014-12/txt/msg00910.txt.bz2
Content-length: 1701

https://gcc.gnu.org/bugzilla/show_bug.cgi?idd237

--- Comment #6 from Markus Trippelsdorf <trippels at gcc dot gnu.org> ---
(In reply to H.J. Lu from comment #5)
> (In reply to Markus Trippelsdorf from comment #4)
> > (In reply to H.J. Lu from comment #3)
> > > (In reply to Markus Trippelsdorf from comment #0)
> > > > trippels@gcc20 nscd % cat nscd.i
> > > > extern int program_invocation_name;
> > > > extern void fn2(int, int);
> > > > void
> > > > fn1() { fn2(0, program_invocation_name); }
> > > >
> > > > trippels@gcc20 nscd % gcc -shared nscd.i -fpie
> > > > /home/trippels/bin/ld: /home/trippels/tmp/ccoI5Lbg.o: relocation
> > > > R_X86_64_PC32 against undefined symbol
> > > > `program_invocation_name@@GLIBC_2.2.5' can not be used when making a shared
> > > > object; recompile with -fPIC
> > > > /home/trippels/bin/ld: final link failed: Bad value
> > > > collect2: error: ld returned 1 exit status
> > >
> > > If you use -fpie, you should use -pie.
> > > If you use -shared, you should use -fpic.
> >
> > -shared was used for demonstration purpose only.
> > Same issue with -pie:
> >
> >  % gcc -O2 -pie nscd.i -fPIE
> > /usr/lib/x86_64-linux-gnu/Scrt1.o: In function `_start':
> > (.text+0x20): undefined reference to `main'
> > /home/trippels/bin/ld: /home/trippels/tmp/ccZF5sOU.o: relocation
> > R_X86_64_PC32 against undefined symbol
> > `program_invocation_name@@GLIBC_2.2.5' can not be used when making a shared
> > object; recompile with -fPIC
>
> Does -fuse-ld=gold work?

Yes.
I've configured and build gcc with gold. glibc doesn't support gold, so I had
to manually switch to ld.bfd.

Adding -fuse-ld=gold to the crtn.o link command posted above, also fixes the
issue.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (21 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: rguenth at gcc dot gnu.org @ 2014-12-10 13:22 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (22 preceding siblings ...)
  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
                   ` (4 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-14 16:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #24 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Sun Dec 14 16:04:11 2014
New Revision: 218720

URL: https://gcc.gnu.org/viewcvs?rev=218720&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

gcc/

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    trunk/gcc/testsuite/g++.dg/pr64037.C
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/combine.c
    trunk/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (23 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-14 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #25 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Sun Dec 14 16:07:03 2014
New Revision: 218721

URL: https://gcc.gnu.org/viewcvs?rev=218721&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

Backported from mainline:

gcc/

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    branches/gcc-4_9-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_9-branch/gcc/ChangeLog
    branches/gcc-4_9-branch/gcc/combine.c
    branches/gcc-4_9-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (24 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-12-15 16:01 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |temporal at gmail dot com

--- Comment #26 from H.J. Lu <hjl.tools at gmail dot com> ---
*** Bug 58192 has been marked as a duplicate of this bug. ***


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (25 preceding siblings ...)
  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
  28 siblings, 0 replies; 30+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-12-19 13:40 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.8.4                       |4.8.5

--- Comment #27 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 4.8.4 has been released.


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (26 preceding siblings ...)
  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
  28 siblings, 0 replies; 30+ messages in thread
From: hjl at gcc dot gnu.org @ 2014-12-19 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #28 from hjl at gcc dot gnu.org <hjl at gcc dot gnu.org> ---
Author: hjl
Date: Fri Dec 19 19:19:33 2014
New Revision: 218967

URL: https://gcc.gnu.org/viewcvs?rev=218967&root=gcc&view=rev
Log:
Pass unpromoted argument to promote_function_mode

This patch updates setup_incoming_promotions in combine.c to match what
is actually passed in assign_parm_setup_reg in function.c.

Backported from mainline:

gcc/

    PR rtl-optimization/64037
    * combine.c (setup_incoming_promotions): Pass the argument
    before any promotions happen to promote_function_mode.

gcc/testsuite/

    PR rtl-optimization/64037
    * g++.dg/pr64037.C: New test.

Added:
    branches/gcc-4_8-branch/gcc/testsuite/g++.dg/pr64037.C
Modified:
    branches/gcc-4_8-branch/gcc/ChangeLog
    branches/gcc-4_8-branch/gcc/combine.c
    branches/gcc-4_8-branch/gcc/testsuite/ChangeLog


^ permalink raw reply	[flat|nested] 30+ messages in thread

* [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os and enum class : char parameter
  2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter js at alien8 dot de
                   ` (27 preceding siblings ...)
  2014-12-19 19:20 ` hjl at gcc dot gnu.org
@ 2014-12-19 19:49 ` hjl.tools at gmail dot com
  28 siblings, 0 replies; 30+ messages in thread
From: hjl.tools at gmail dot com @ 2014-12-19 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #29 from H.J. Lu <hjl.tools at gmail dot com> ---
Fixed for 4.8.5


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2014-12-19 19:49 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-23 23:07 [Bug c++/64037] New: Miscompilation with LTO and enum class : char parameter 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 ` [Bug rtl-optimization/64037] [4.8/4.9/5 Regression] Miscompilation with -Os " hjl.tools at gmail dot com
2014-11-28 15:28 ` 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

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).