Issue Details (XML | Word | Printable)

Key: PCC-202
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Nicolas Joly
Votes: 0
Watchers: 0
Operations

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

cpp sometimes include ^D/^E characters

Created: 03/Dec/10 06:36 PM   Updated: 18/Dec/10 05:07 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment:
NetBSD lanfeust.sis.pasteur.fr 5.99.41 NetBSD 5.99.41 (LANFEUST) #24: Fri Dec 3 12:01:14 CET 2010 njoly@lanfeust.sis.pasteur.fr:/local/src/NetBSD/obj.amd64/sys/arch/amd64/compile/LANFEUST amd64
pcc 0.9.9 for x86_64-unknown-netbsd5.99.41, njoly@lanfeust.sis.pasteur.fr Fri Dec 3 18:26:49 CET 2010


 Description  « Hide

In the following sample, the preprocessor will add some ^D/^E characters, which can then lead to unpredicted results (seen with assert macro) ...

njoly@lanfeust [~]> cat xx.c
#define xprint(x) printf("%s\n", #x)
#define yprint(y) xprint(2+y)

int main() {
  xprint(1+1);
  yprint(1+1);
  return 0; }

njoly@lanfeust [~]> pcc -E xx.c | od -c
0000000 \n # 1 " x x . c " \n \n \n \n \n
0000020 \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
0000040 \n \n \n \n # 1 " x x . c " \n \n
0000060 \n \n i n t m a i n ( ) { \n
0000100 p r i n t f ( " % s \ n " ,
0000120 " 1 + 1 " ) ; \n p r i n t f
0000140 ( " % s \ n " , " 2 + 004 1 + 1
0000160 005 " ) ; \n r e t u r n 0 ;
0000200 } \n
0000203


Notice the 004 and 005 characters in the preprocessed output.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 18/Dec/10 05:07 PM
Fixed. Now these EXP/NOEXP internal identifiers should not be emitted inside strings.