public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/5091: variables qualified volatile of type va_list will cause a segmentation fault
@ 2001-12-12 20:36 rodrigc
0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2001-12-12 20:36 UTC (permalink / raw)
To: nobody; +Cc: gcc-prs
The following reply was made to PR c/5091; it has been noted by GNATS.
From: rodrigc@gcc.gnu.org
To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org,
maierkom@rcs.ei.tum.de, nobody@gcc.gnu.org
Cc:
Subject: Re: c/5091: variables qualified volatile of type va_list will cause a segmentation fault
Date: 13 Dec 2001 04:28:14 -0000
Synopsis: variables qualified volatile of type va_list will cause a segmentation fault
State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Wed Dec 12 20:28:14 2001
State-Changed-Why:
I can reproduce your segfault.
I don't think you are doing a very safe thing by
defining a volatile va_list. va_list is usually a macro
which expands to a compiler, platform, and architecture
specific thing. So messing around with va_list is not
safe.
If I compile your code with g++ instead of gcc, I get the
following errors:
varargtest.c: In function `void foo(char*, ...)':
varargtest.c:10: could not convert `ap' to `void*&'
<internal>:10: in passing argument 1 of `void __builtin_stdarg_start(void*&,
...)'
varargtest.c:27: could not convert `ap' to `void*&'
<internal>:27: in passing argument 1 of `void __builtin_va_end(void*&)
If I were you, I would try to change my code generator
or generated code.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5091&database=gcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: c/5091: variables qualified volatile of type va_list will cause a segmentation fault
@ 2001-12-12 20:28 rodrigc
0 siblings, 0 replies; 3+ messages in thread
From: rodrigc @ 2001-12-12 20:28 UTC (permalink / raw)
To: gcc-bugs, gcc-gnats, gcc-prs, maierkom, nobody
Synopsis: variables qualified volatile of type va_list will cause a segmentation fault
State-Changed-From-To: open->analyzed
State-Changed-By: rodrigc
State-Changed-When: Wed Dec 12 20:28:14 2001
State-Changed-Why:
I can reproduce your segfault.
I don't think you are doing a very safe thing by
defining a volatile va_list. va_list is usually a macro
which expands to a compiler, platform, and architecture
specific thing. So messing around with va_list is not
safe.
If I compile your code with g++ instead of gcc, I get the
following errors:
varargtest.c: In function `void foo(char*, ...)':
varargtest.c:10: could not convert `ap' to `void*&'
<internal>:10: in passing argument 1 of `void __builtin_stdarg_start(void*&,
...)'
varargtest.c:27: could not convert `ap' to `void*&'
<internal>:27: in passing argument 1 of `void __builtin_va_end(void*&)
If I were you, I would try to change my code generator
or generated code.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5091&database=gcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* c/5091: variables qualified volatile of type va_list will cause a segmentation fault
@ 2001-12-12 0:26 maierkom
0 siblings, 0 replies; 3+ messages in thread
From: maierkom @ 2001-12-12 0:26 UTC (permalink / raw)
To: gcc-gnats
>Number: 5091
>Category: c
>Synopsis: variables qualified volatile of type va_list will cause a segmentation fault
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: wrong-code
>Submitter-Id: net
>Arrival-Date: Wed Dec 12 00:26:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Thomas Maier-Komor
>Release: 3.0.0, 3.0.1, 3.0.2
>Organization:
>Environment:
Linux 2.4
>Description:
if one qulifies a variable of type va_list (#include <stdarg.h>) with volatile the program will crash. The variable will own an incorrect address (not on the stack).
This happens with all recent gcc 3.x versions - but not with
the older 2.95.x series
>How-To-Repeat:
The attached file is just a copy of the man page example with volatile inserted. just: compile - run - bang...
>Fix:
Workaround: do not use volatile - but I can't as the code, which I would like to get compiled is automatically generated... So a fix in 3.0.3 would be very helpful. Thanks.
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/x-csrc; name="varargtest.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="varargtest.c"
I2luY2x1ZGUgPHN0ZGFyZy5oPgojaW5jbHVkZSA8c3RkaW8uaD4KCnZvaWQgCmZvbyAoY2hhciAq
Zm10LC4uLikKewogIHZvbGF0aWxlIHZhX2xpc3QgYXA7CiAgaW50IGQ7CiAgY2hhciBjLCAqcCwg
KnM7CiAgdmFfc3RhcnQgKGFwLCBmbXQpOwogIHdoaWxlICgqZm10KQogICAgc3dpdGNoICgqZm10
KyspCiAgICAgIHsKICAgICAgY2FzZSAncyc6CQkvKiBzdHJpbmcgKiAqLwoJcyA9IHZhX2FyZyAo
YXAsIGNoYXIgKik7CglwcmludGYgKCJzdHJpbmcgJXNcbiIsIHMpOwoJYnJlYWs7CiAgICAgIGNh
c2UgJ2QnOgkJLyogaW50ICogKi8KCWQgPSB2YV9hcmcgKGFwLCBpbnQpOwoJcHJpbnRmICgiaW50
ICVkXG4iLCBkKTsKCWJyZWFrOwogICAgICBjYXNlICdjJzoJCS8qIGNoYXIgKiAqLy8qIG5lZWQg
KiBhICogY2FzdCAqIGhlcmUgKiBzaW5jZSAqIHZhX2FyZyAqIG9ubHkgdGFrZXMgZnVsbHkgcHJv
bW90ZWQgdHlwZXMgKi8KCWMgPSAoY2hhcikgdmFfYXJnIChhcCwgaW50KTsKCXByaW50ZiAoImNo
YXIgJWNcbiIsIGMpOwoJYnJlYWs7CiAgICAgIH0KICB2YV9lbmQgKGFwKTsKfQoKaW50IAptYWlu
ICgpCnsKICBmb28oInNkIiwiYWJjIiwzKTsKICByZXR1cm4gMDsKfQo=
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2001-12-13 4:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-12 20:36 c/5091: variables qualified volatile of type va_list will cause a segmentation fault rodrigc
-- strict thread matches above, loose matches on Subject: below --
2001-12-12 20:28 rodrigc
2001-12-12 0:26 maierkom
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).