bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: code example


From: Andreas Schwab
Subject: Re: code example
Date: Tue, 25 Sep 2007 13:22:17 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.1 (gnu/linux)

"Cristian Baboi" <address@hidden> writes:

> On Tue, 25 Sep 2007 02:04:26 +0300, Bruno Haible <address@hidden> wrote:
>> Thank you for reporting this. Indeed, a call to va_copy is missing here,
>> since a va_list can only be traversed once, not twice. I have applied the
>> appended patch. But I don't understand the need for va_copy in the second
>> part of your patch. Why should that be needed?
>>
>
> The following code give segfault on RHEL4 AS x86_64 if compiled with -m32
> flag.
> #include <stdio.h>
>
> typedef struct {
>   float a;
>   float b;
> } pt[1];
>
> pt* f(pt *p){
>     return p;
> };
>
> pt* g(pt p){
>     return f(&p);
> };
>
> main(){
> pt x,*y;
>     x[1].a=1.1;
>     x[1].b=1.2;
>     y=g(x);
> };

This program is invalid.

array.c:13: warning: passing argument 1 of 'f' from incompatible pointer type

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]