Issue Details (XML | Word | Printable)

Key: PCC-403
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Unassigned
Reporter: Iain Hibbert
Votes: 0
Watchers: 0

If you were logged in you would be able to see more operations.

#if conditional leaks some information

Created: 25/Aug/12 12:54 PM   Updated: 15/Sep/12 07:13 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386

 Description  « Hide
The #if conditional is leaking some information when the test is expanded from a macro, which carries over to affect the next conditional

the following code demonstrates the issue

#define VAL 5
#define FOO defined(VAL)
#define BAR defined(FOOBAR)

#if FOO
foo: FOO

#if BAR
bar: BAR

when compiled with pcc -E, produces (without blank lines)

foo: defined(5)
bar: defined(FOOBAR)

which is clearly wrong.. but if the code is changed to

#if TEST
test: TEST

#if BAR
bar: BAR

then it works ok..

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Iain Hibbert made changes - 15/Sep/12 07:13 PM
Field Original Value New Value
Status Open [ 1 ] Closed [ 6 ]
Resolution Fixed [ 1 ]