public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sje at cup dot hp dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/19454] New: bad code generated with gcc.c-torture/execute/bf64-1.c at -O1
Date: Sat, 15 Jan 2005 00:50:00 -0000	[thread overview]
Message-ID: <20050115005010.19454.sje@cup.hp.com> (raw)

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


             reply	other threads:[~2005-01-15  0:50 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-15  0:50 sje at cup dot hp dot com [this message]
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

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=20050115005010.19454.sje@cup.hp.com \
    --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).