public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
@ 2005-01-15  0:50 sje at cup dot hp dot com
  2005-01-15  1:42 ` [Bug middle-end/19454] [4.0 Regression] " pinskia at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: sje at cup dot hp dot com @ 2005-01-15  0:50 UTC (permalink / raw)
  To: gcc-bugs

Here is a slightly modified version of bf64-1.c with print statments:

struct tmp
{
  long long int pad : 12;
  long long int field : 52;
};

struct tmp2
{
  long long int field : 52;
  long long int pad : 12;
};

struct tmp  sub  (struct tmp  xtmp);
struct tmp2 sub2 (struct tmp2 xtmp2);

struct tmp
sub (struct tmp xtmp)
{
  xtmp.field |= 0x0008765412345678LL;
  return xtmp;
}

struct tmp2
sub2 (struct tmp2 xtmp2)
{
  xtmp2.field |= 0x0008765412345678LL;
  return xtmp2;
}

main()
{
  struct tmp xtmp = {0x123, 0xFFF000FFF000FLL};
  struct tmp2 xtmp2 = {0xFFF000FFF000FLL, 0x123};

  xtmp = sub (xtmp);
  xtmp2 = sub2 (xtmp2);
  printf("%lld\n", xtmp.pad);
  printf("%lld\n", xtmp.field);
  printf("%lld\n", xtmp2.pad);
  printf("%lld\n", xtmp2.field);
  exit (0);
}

With -O0 it prints:

291
-738197547393
291
-738197547393

At -O1 it prints:

291
1479942473249059
291
-738197547393


This bug happens on IA64 HP-UX (with -O1 and in 32 or 64 bit mode) but not on
IA64 Linux.  I tracked the start of failure to the following patch but was
unable to figure out what the exact problem is.

2004-09-03  Richard Henderson  <rth@redhat.com>

        PR middle-end/9997
        * cfgexpand.c (LOCAL_ALIGNMENT): Provide default.
        (STACK_ALIGNMENT_NEEDED, FRAME_GROWS_DOWNWARD): Likewise.
        (struct stack_var, EOC, stack_vars, stack_vars_alloc, stack_vars_num,
        stack_vars_sorted, stack_vars_conflict, stack_vars_conflict_alloc,
        frame_phase, get_decl_align_unit, add_stack_var, triangular_index,
        resize_stack_vars_conflict, add_stack_var_conflict,
        stack_var_conflict_p, add_alias_set_conflicts, stack_var_size_cmp,
        union_stack_vars, partition_stack_vars, dump_stack_var_partition,
        expand_one_stack_var_at, expand_stack_vars, expand_one_stack_var,
        expand_one_static_var, expand_one_hard_reg_var,
        expand_one_register_var, expand_one_error_var, defer_stack_allocation,
        expand_one_var, expand_used_vars_for_block, clear_tree_used): New.
        (expand_used_vars): Rewrite.
        * Makefile.in (cfgexpand.o): Update dependencies.

-- 
           Summary: bad code generated with gcc.c-torture/execute/bf64-1.c
                    at -O1
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sje at cup dot hp dot com
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: ia64-hp-hpux11.20


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
@ 2005-01-15  1:42 ` pinskia at gcc dot gnu dot org
  2005-02-01 18:44 ` pinskia at gcc dot gnu dot org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-01-15  1:42 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org
           Keywords|                            |wrong-code
            Summary|bad code generated with     |[4.0 Regression] bad code
                   |gcc.c-torture/execute/bf64- |generated with gcc.c-
                   |1.c at -O1                  |torture/execute/bf64-1.c at
                   |                            |-O1
   Target Milestone|---                         |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
  2005-01-15  1:42 ` [Bug middle-end/19454] [4.0 Regression] " pinskia at gcc dot gnu dot org
@ 2005-02-01 18:44 ` pinskia at gcc dot gnu dot org
  2005-03-05 19:57 ` [Bug middle-end/19454] [4.0/4.1 " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-01 18:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-01 18:43 -------
Removing target milestone per: <http://gcc.gnu.org/ml/gcc/2005-01/msg01255.html> as it is known 
to not to effect primary/secondary targets.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|4.0.0                       |---


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0/4.1 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
  2005-01-15  1:42 ` [Bug middle-end/19454] [4.0 Regression] " pinskia at gcc dot gnu dot org
  2005-02-01 18:44 ` pinskia at gcc dot gnu dot org
@ 2005-03-05 19:57 ` pinskia at gcc dot gnu dot org
  2005-03-20  2:53 ` [Bug middle-end/19454] [4.0 " jsm28 at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-03-05 19:57 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.1.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (2 preceding siblings ...)
  2005-03-05 19:57 ` [Bug middle-end/19454] [4.0/4.1 " pinskia at gcc dot gnu dot org
@ 2005-03-20  2:53 ` jsm28 at gcc dot gnu dot org
  2005-03-21 14:24 ` bonzini at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-03-20  2:53 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-03-20 02:53 -------
These test failures are fixed on mainline by:

2005-03-01  Paolo Bonzini  <bonzini@gnu.org>
        
        * combine.c (gen_binary): Remove.
        (known_cond, simplify_shift_const, find_split_point,
        combine_simplify_rtx, simplify_if_then_else, simplify_set,
        simplify_logical, expand_field_assignment, extract_left_shift,
        force_to_mode, if_then_else_cond, apply_distributive_law,
        simplify_and_const_int, simplify_shift_const, gen_lowpart_for_combine,
        simplify_comparison, reversed_comparison): Replace with
        simplify_gen_binary, simplify_gen_relational or
        distribute_and_simplify_rtx.
        (distribute_and_simplify_rtx): New function.

I haven't yet tested this patch with 4.0 branch to see if it fixes them there.


-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bonzini at gcc dot gnu dot
                   |                            |org, jsm28 at gcc dot gnu
                   |                            |dot org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2005-03-20 02:53:07
               date|                            |
            Summary|[4.0/4.1 Regression] bad    |[4.0 Regression] bad code
                   |code generated with gcc.c-  |generated with gcc.c-
                   |torture/execute/bf64-1.c at |torture/execute/bf64-1.c at
                   |-O1                         |-O1


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (3 preceding siblings ...)
  2005-03-20  2:53 ` [Bug middle-end/19454] [4.0 " jsm28 at gcc dot gnu dot org
@ 2005-03-21 14:24 ` bonzini at gcc dot gnu dot org
  2005-03-24 17:44 ` bonzini at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-03-21 14:24 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-03-21 14:23 -------
I'm looking into why the patch fixes the change

-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (4 preceding siblings ...)
  2005-03-21 14:24 ` bonzini at gcc dot gnu dot org
@ 2005-03-24 17:44 ` bonzini at gcc dot gnu dot org
  2005-04-01  8:25 ` bonzini at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-03-24 17:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bonzini at gcc dot gnu dot org  2005-03-24 17:44 -------
Added PR20600, since the patch causes that regression.  Both patches were
approved for 4.0 once the PR20600 patch is approved into mainline.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |bonzini at gcc dot gnu dot
                   |dot org                     |org
             Status|NEW                         |ASSIGNED
   Last reconfirmed|2005-03-20 02:53:07         |2005-03-24 17:44:51
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (5 preceding siblings ...)
  2005-03-24 17:44 ` bonzini at gcc dot gnu dot org
@ 2005-04-01  8:25 ` bonzini at gcc dot gnu dot org
  2005-04-01 11:23 ` cvs-commit at gcc dot gnu dot org
  2005-04-04 10:29 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: bonzini at gcc dot gnu dot org @ 2005-04-01  8:25 UTC (permalink / raw)
  To: gcc-bugs



-- 
Bug 19454 depends on bug 20600, which changed state.

Bug 20600 Summary: [4.1 regression] failure for pass.c on x86_64-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20600

           What    |Old Value                   |New Value
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (6 preceding siblings ...)
  2005-04-01  8:25 ` bonzini at gcc dot gnu dot org
@ 2005-04-01 11:23 ` cvs-commit at gcc dot gnu dot org
  2005-04-04 10:29 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2005-04-01 11:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2005-04-01 11:23 -------
Subject: Bug 19454

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	bonzini@gcc.gnu.org	2005-04-01 11:23:08

Modified files:
	gcc            : ChangeLog combine.c 
	gcc/config/i386: i386.c 

Log message:
	2005-04-01  Paolo Bonzini  <bonzini@gnu.org>
	
	PR middle-end/19454
	PR rtl-optimization/20600
	
	* combine.c (gen_binary): Remove.
	(known_cond, simplify_shift_const, find_split_point,
	combine_simplify_rtx, simplify_if_then_else, simplify_set,
	simplify_logical, expand_field_assignment, extract_left_shift,
	force_to_mode, if_then_else_cond, apply_distributive_law,
	simplify_and_const_int, simplify_shift_const, gen_lowpart_for_combine,
	simplify_comparison, reversed_comparison): Replace with
	simplify_gen_binary, simplify_gen_relational or
	distribute_and_simplify_rtx.
	(distribute_and_simplify_rtx): New function.
	
	* config/i386/i386.c (ix86_decompose_address): Look inside SUBREGs
	to fix addresses involving EBP and ESP.
	(aligned_operand, legitimate_address_p, ix86_address_cost): Be prepared
	for SUBREGed registers.
	(legitimate_address_p): Accept SUBREGed registers.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.107&r2=2.7592.2.108
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/combine.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.475.4.1&r2=1.475.4.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/config/i386/i386.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.795.6.1&r2=1.795.6.2



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

* [Bug middle-end/19454] [4.0 Regression] bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
  2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
                   ` (7 preceding siblings ...)
  2005-04-01 11:23 ` cvs-commit at gcc dot gnu dot org
@ 2005-04-04 10:29 ` jsm28 at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2005-04-04 10:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From jsm28 at gcc dot gnu dot org  2005-04-04 10:29 -------
Test now passes on 4.0 branch as well as mainline after patch was applied.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|4.1.0                       |4.0.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19454


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

end of thread, other threads:[~2005-04-04 10:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-01-15  0:50 [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1 sje at cup dot hp dot com
2005-01-15  1:42 ` [Bug middle-end/19454] [4.0 Regression] " pinskia at gcc dot gnu dot org
2005-02-01 18:44 ` pinskia at gcc dot gnu dot org
2005-03-05 19:57 ` [Bug middle-end/19454] [4.0/4.1 " pinskia at gcc dot gnu dot org
2005-03-20  2:53 ` [Bug middle-end/19454] [4.0 " jsm28 at gcc dot gnu dot org
2005-03-21 14:24 ` bonzini at gcc dot gnu dot org
2005-03-24 17:44 ` bonzini at gcc dot gnu dot org
2005-04-01  8:25 ` bonzini at gcc dot gnu dot org
2005-04-01 11:23 ` cvs-commit at gcc dot gnu dot org
2005-04-04 10:29 ` jsm28 at gcc dot gnu dot org

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