public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: preprocessor/3260: #include __FILE__ broken
@ 2001-06-19 8:07 neil
0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2001-06-19 8:07 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, nobody, schwab
Synopsis: #include __FILE__ broken
State-Changed-From-To: open->analyzed
State-Changed-By: neil
State-Changed-When: Tue Jun 19 08:07:17 2001
State-Changed-Why:
Confirmed, how embarrassing.
It is __FILE__ that is broken -- the string is not null-terminated -- though we may get away with it in some cases.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3260&database=gcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: preprocessor/3260: #include __FILE__ broken
@ 2001-06-21 14:04 neil
0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2001-06-21 14:04 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, neil, schwab
Synopsis: #include __FILE__ broken
State-Changed-From-To: analyzed->closed
State-Changed-By: neil
State-Changed-When: Thu Jun 21 14:04:01 2001
State-Changed-Why:
Fixed.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3260&database=gcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: preprocessor/3260: #include __FILE__ broken
@ 2001-06-21 13:46 Neil Booth
0 siblings, 0 replies; 5+ messages in thread
From: Neil Booth @ 2001-06-21 13:46 UTC (permalink / raw)
To: neil; +Cc: gcc-prs
The following reply was made to PR preprocessor/3260; it has been noted by GNATS.
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Andreas Schwab <schwab@suse.de>
Cc: gcc-gnats@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: preprocessor/3260: #include __FILE__ broken
Date: Thu, 21 Jun 2001 21:42:39 +0100
Andreas Schwab wrote:-
> #include __FILE__ does not work.
> >How-To-Repeat:
> $ cat file.c
> #define PASS 1
> #if PASS == 1
> #undef PASS
> #define PASS 2
> #include __FILE__
> #undef PASS
> #define PASS 3
> #include __FILE__
> #endif
> PASS
> $ gcc -E file.c
> file.c:5:18: file.c__: No such file or directory
> file.c:8:18: file.c__: Success
> # 10 "file.c"
> 3
Fixed with this patch. Curiously, this bug cannot be reproduced with
3.1, because of the changes we made in merging hashtables. That
doesn't detract from the fact that there is a latent bug, though.
Also, the bogosity above where the 2nd error message is "Success" is
already fixed in 3.1. The fix was disruptive, so I didn't put it in
3.0.
Bootstrapped & made check x86 Linux. I'll apply this to branch if and
when we decide about 3.0.1.
Neil.
* cppmacro.c (make_string_token): Null terminate.
Index: cppmacro.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cppmacro.c,v
retrieving revision 1.52
diff -u -p -r1.52 cppmacro.c
--- cppmacro.c 2001/05/20 06:26:34 1.52
+++ cppmacro.c 2001/06/21 20:37:28
@@ -105,11 +105,12 @@ make_string_token (pool, token, text, le
const U_CHAR *text;
unsigned int len;
{
- U_CHAR *buf = _cpp_pool_alloc (pool, len * 4);
+ U_CHAR *buf = _cpp_pool_alloc (pool, len * 4 + 1);
token->type = CPP_STRING;
token->val.str.text = buf;
token->val.str.len = quote_string (buf, text, len) - buf;
+ token->val.str.text[token->val.str.len] = '\0';
token->flags = 0;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: preprocessor/3260: #include __FILE__ broken
@ 2001-06-19 8:09 neil
0 siblings, 0 replies; 5+ messages in thread
From: neil @ 2001-06-19 8:09 UTC (permalink / raw)
To: gcc-bugs, gcc-prs, neil, nobody, schwab
Synopsis: #include __FILE__ broken
Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Tue Jun 19 08:09:24 2001
Responsible-Changed-Why:
Patch in progress.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3260&database=gcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* preprocessor/3260: #include __FILE__ broken
@ 2001-06-19 7:16 Andreas Schwab
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2001-06-19 7:16 UTC (permalink / raw)
To: gcc-gnats
>Number: 3260
>Category: preprocessor
>Synopsis: #include __FILE__ broken
>Confidential: no
>Severity: critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: rejects-legal
>Submitter-Id: net
>Arrival-Date: Tue Jun 19 07:16:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:
>Release: 3.0 20010611 (prerelease)
>Organization:
>Environment:
System: Linux D65 2.4.4 #1 SMP Wed Jun 13 21:43:48 GMT 2001 ia64 unknown
Architecture: ia64
host: ia64-suse-linux-gnu
build: ia64-suse-linux-gnu
target: ia64-suse-linux-gnu
configured with: ../configure --enable-threads=posix --enable-long-long --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java --with-gxx-include-dir=/usr/include/g++ --enable-nls --with-slibdir=/lib --enable-shared ia64-suse-linux
>Description:
#include __FILE__ does not work.
>How-To-Repeat:
$ cat file.c
#define PASS 1
#if PASS == 1
#undef PASS
#define PASS 2
#include __FILE__
#undef PASS
#define PASS 3
#include __FILE__
#endif
PASS
$ gcc -E file.c
file.c:5:18: file.c__: No such file or directory
file.c:8:18: file.c__: Success
# 10 "file.c"
3
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2001-06-21 14:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-19 8:07 preprocessor/3260: #include __FILE__ broken neil
-- strict thread matches above, loose matches on Subject: below --
2001-06-21 14:04 neil
2001-06-21 13:46 Neil Booth
2001-06-19 8:09 neil
2001-06-19 7:16 Andreas Schwab
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).