public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/19263] [3.4/4.0 regression]: wrong-code: explicit inicialization of v8qi miscompiled
Date: Wed, 12 Jan 2005 18:00:00 -0000	[thread overview]
Message-ID: <20050112180020.23133.qmail@sourceware.org> (raw)
In-Reply-To: <20050105125215.19263.smelkov@mph1.phys.spbu.ru>


------- Additional Comments From jakub at gcc dot gnu dot org  2005-01-12 18:00 -------
This seems to be because of the CONSTRUCTOR_ELTS (init) = NULL;
added in http://gcc.gnu.org/ml/gcc-patches/2004-01/msg00832.html
by Richard.
If I remove it, the testcase works, as well as this bigger one below.
Wiping the initializers of the vector can't be right, so either that line
can be just deleted, or we want to create zero vector and then initialize
it field by field with the original values.
typedef signed char v8qi __attribute__ ((vector_size (8)));

extern "C" void abort (void);

static unsigned char S[16];

struct A
{
  int i;
  v8qi j, k;
  int l;
};

void
foo (unsigned char v)
{
  A a = { 1, { v, v, v, v, v, v, v, v },
             { v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1, v + 1 }, 3 };
  v8qi *s = (v8qi *) & S[0];
  *s = a.j;
  s[1] = a.k;
}

void
bar (unsigned char v)
{
  v8qi val8 = { v, v, v, v, v, v, v, v };
  v8qi *s = (v8qi *) & S[0];
  *s = val8;
}

int
main ()
{
  int i;
  foo (1);
  for (i = 0; i < 8; ++i)
    if (S[i] != 1)
      abort ();
  for (; i < 16; ++i)
    if (S[i] != 2)
      abort ();
  bar (3);
  for (i = 0; i < 8; ++i)
    if (S[i] != 3)
      abort ();
  return 0;
}



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rth at gcc dot gnu dot org


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


  parent reply	other threads:[~2005-01-12 18:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-05 12:52 [Bug c++/19263] New: [g++-3.4.3 " smelkov at mph1 dot phys dot spbu dot ru
2005-01-05 14:48 ` [Bug c++/19263] [3.4/4.0 " pinskia at gcc dot gnu dot org
2005-01-05 14:57 ` pinskia at gcc dot gnu dot org
2005-01-12 17:30 ` jakub at gcc dot gnu dot org
2005-01-12 18:00 ` jakub at gcc dot gnu dot org [this message]
2005-01-12 18:30 ` jakub at gcc dot gnu dot org
2005-01-12 19:16 ` pinskia at gcc dot gnu dot org
2005-01-14 23:46 ` [Bug c++/19263] [3.4/4.0 regression]: wrong-code: explicit initialization " cvs-commit at gcc dot gnu dot org
2005-01-14 23:52 ` cvs-commit at gcc dot gnu dot org
2005-01-15  1:50 ` pinskia 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=20050112180020.23133.qmail@sourceware.org \
    --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).