This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/5091: variables qualified volatile of type va_list will cause a segmentation fault



>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=


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]