This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/24306] [3.4/4.0/4.1/4.2 Regression] va_arg gets confused when skipping over certain zero-sized types with -msse
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Dec 2005 11:34:32 -0000
- Subject: [Bug target/24306] [3.4/4.0/4.1/4.2 Regression] va_arg gets confused when skipping over certain zero-sized types with -msse
- References: <bug-24306-602@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #5 from rguenth at gcc dot gnu dot org 2005-12-19 11:34 -------
We add some alignment fluff in the SSE type case. The following works as
expected:
#include <stdarg.h>
typedef int __attribute__ ((vector_size (16))) foo_t;
extern void abort(void);
struct s
{
_Complex double f[0];
} s1;
void
check (int x, ...)
{
int y;
va_list ap;
va_start (ap, x);
va_arg (ap, struct s);
y = va_arg (ap, int);
/* Expect output: 3 7 */
if (y != 7)
abort ();
}
int main()
{
check (3, s1, 7);
return 0;
}
.vars dump difference, working agains non-working:
--- t2.c.t96.vars 2005-12-19 12:22:09.000000000 +0100
+++ t.c.t96.vars 2005-12-19 12:15:08.000000000 +0100
@@ -5,10 +5,12 @@
{
char * ap;
char * D.1699;
+ char * ap.0;
<bb 2>:
__builtin_va_start (&ap, 0, 0);
- D.1699 = ap;
+ ap.0 = ap;
+ D.1699 = ap.0 + 15B & -16B;
if (*(int *) D.1699 != 7) goto <L0>; else goto <L1>;
<L0>:;
We have a bug here in the generic builtins.c and the config/i386/i386.c variant
of gimplify_va_arg_expr - and I have a fix.
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |rguenth at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2005-10-11 14:02:39 |2005-12-19 11:34:31
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24306