https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #53 from David Malcolm ---
(In reply to Manuel López-Ibáñez from comment #51)
> 2. Locations within strings expanded from a macro
(2) should also be fixed for gcc 9 by r264887:
/tmp/foo.c: In function ‘foo’:
/tmp/foo.c:2:25:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #52 from David Malcolm ---
(In reply to Manuel López-Ibáñez from comment #51)
> 1. C++ does not work
C++ should be fixed for gcc 9 by r264887.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Bug 52952 depends on bug 56856, which changed state.
Bug 56856 Summary: -Wformat warnings don't show location *within* format string
in C++ FE
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56856
What|Removed
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #51 from Manuel López-Ibáñez ---
There are few things still that don't work:
1. C++ does not work
2. Locations within strings expanded from a macro
3. Location within strings from a const char array.
void foo(void) {
#define c
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #50 from Eric Gallager ---
(In reply to Bernd Edlinger from comment #49)
> Author: edlinger
> Date: Mon Aug 22 07:34:34 2016
> New Revision: 239649
>
> URL: https://gcc.gnu.org/viewcvs?rev=239649=gcc=rev
> Log:
> 2016-08-22 Bernd
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #49 from Bernd Edlinger ---
Author: edlinger
Date: Mon Aug 22 07:34:34 2016
New Revision: 239649
URL: https://gcc.gnu.org/viewcvs?rev=239649=gcc=rev
Log:
2016-08-22 Bernd Edlinger
PR c/52952
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #48 from Bernd Edlinger ---
somethin like that fixes it for me:
Index: pr66415-1.c
===
--- pr66415-1.c (revision 239624)
+++ pr66415-1.c (working copy)
@@ -1,6 +1,7 @@
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #47 from Bernd Edlinger ---
COLUMNS=82 make check-gcc-c RUNTESTFLAGS="cpp.exp=pr66415-1.c"
...
Running /home/ed/gnu/gcc-trunk/gcc/testsuite/gcc.dg/cpp/cpp.exp ...
=== gcc Summary ===
# of expected passes
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Bernd Edlinger changed:
What|Removed |Added
CC||bernd.edlinger at hotmail dot
de
---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #45 from David Malcolm ---
Author: dmalcolm
Date: Mon Aug 8 20:10:19 2016
New Revision: 239253
URL: https://gcc.gnu.org/viewcvs?rev=239253=gcc=rev
Log:
Use class substring_loc in c-format.c (PR c/52952)
gcc/c-family/ChangeLog:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
David Malcolm changed:
What|Removed |Added
Status|NEW |ASSIGNED
Assignee|unassigned
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
David Malcolm changed:
What|Removed |Added
CC||dmalcolm at gcc dot gnu.org
--- Comment
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #42 from Manuel López-Ibáñez ---
(In reply to Manuel López-Ibáñez from comment #39)
> 2. Handle non-contiguous strings:
>
> __builtin_printf(" %" "d ", 0.5);
Right now, we detect that the offset is outside the first string and
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez changed:
What|Removed |Added
CC||ch3root at openwall dot com
---
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez changed:
What|Removed |Added
Last reconfirmed|2012-04-12 00:00:00 |2015-9-8
--- Comment #40 from
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #38 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Author: manu
Date: Thu May 21 06:49:38 2015
New Revision: 223470
URL: https://gcc.gnu.org/viewcvs?rev=223470root=gccview=rev
Log:
gcc/testsuite/ChangeLog:
2015-05-21 Manuel
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #39 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
A summary of what is still pending:
1. Handle macros
#define c%d
__builtin_printf(c, 0.5);
2. Handle non-contiguous strings:
__builtin_printf( % d ,
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #37 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to do...@seketeli.org from comment #9)
manu at gcc dot gnu.org gcc-bugzi...@gcc.gnu.org a écrit:
So either one keeps track of all source locations of all
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #36 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Latest patch: https://gcc.gnu.org/ml/gcc-patches/2014-11/msg00663.html
Joseph pointed out that it does not handle escape sequences. The only solution
I can think of is to open
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
Attachment #33647|0 |1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #33 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Manuel López-Ibáñez from comment #32)
Created attachment 33648 [details]
dynamically create locations from loc + offset
This version is able to handle macros:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #34 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Manuel López-Ibáñez from comment #27)
(In reply to Manuel López-Ibáñez from comment #25)
* Cases like:
1: const str[] = something %d;
2: printf(str);
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #35 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Jakub Jelinek from comment #13)
I guess the C/C++ FEs could for non-trivial string literals put into a hash
table mapping from locus_t (of ADDR_EXPR around
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
Attachment #27466|0 |1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #31 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Manuel López-Ibáñez from comment #30)
Created attachment 33647 [details]
create locations from loc + offset
This variant works for simple strings. However, it
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #29 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Author: manu
Date: Tue Aug 19 02:02:09 2014
New Revision: 214129
URL: https://gcc.gnu.org/viewcvs?rev=214129root=gccview=rev
Log:
gcc/c-family/ChangeLog:
2014-08-19 Manuel
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #27 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
(In reply to Manuel López-Ibáñez from comment #25)
* Cases like:
1: const str[] = something %d;
2: printf(str);
Note that clang is able to handle this:
manuel@gcc10:~$
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #28 from Manuel López-Ibáñez manu at gcc dot gnu.org ---
Testcase:
void foo(void)
{
char str[] = something %d;
__builtin_printf(str);
}
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
CC||chengniansun
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #25 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-04-05
22:02:26 UTC ---
I am currently stuck on the three problems I described above and I cannot
figure out a way to fix any of them:
* How to reprocess tokens that need to
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #22 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-04-01
14:17:45 UTC ---
(In reply to comment #13)
and didn't need to be translated. So, printf (%.*d); (the common case)
wouldn't have to be recorded, while printf (R(%) .
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
Attachment #29753|0 |1
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #24 from Paolo Carlini paolo.carlini at oracle dot com 2013-04-01
14:32:27 UTC ---
(Nit: careful with the GCC coding style, eg, open curly bracket on a new line)
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #15 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-30
12:32:08 UTC ---
(In reply to comment #13)
I guess the C/C++ FEs could for non-trivial string literals put into a hash
table mapping from locus_t (of ADDR_EXPR around
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #16 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-30
12:32:57 UTC ---
Created attachment 29753
-- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29753
loc_token_hash
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
CC||joseph at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #18 from stevenb.gcc at gmail dot com stevenb.gcc at gmail dot
com 2013-03-30 12:54:12 UTC ---
* It would be extremely nice to update the testsuite to check the locations
are
correct. This is unfortunately a lot of boring
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #19 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-30
13:26:19 UTC ---
Unfortunately, there are some stuff like this:
addr_expr 0x7708f680
type pointer_type 0x77094690
type array_type 0x77094540
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #20 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-30
15:02:11 UTC ---
(In reply to comment #18)
* It would be extremely nice to update the testsuite to check the locations
are
correct. This is unfortunately a lot of
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #21 from Manuel López-Ibáñez manu at gcc dot gnu.org 2013-03-30
15:03:14 UTC ---
Created attachment 29755
-- http://gcc.gnu.org/bugzilla/attachment.cgi?id=29755
add locations and offsets to format warnings
My current patch,
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
CC||tromey at
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #12 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-25
14:09:00 UTC ---
Basically, the current encoding of the map requires that a new location
encoding in a map must always be the last location of that map. You
cannot
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #13 from Jakub Jelinek jakub at gcc dot gnu.org 2012-05-25
14:17:41 UTC ---
I guess the C/C++ FEs could for non-trivial string literals put into a hash
table mapping from locus_t (of ADDR_EXPR around STRING_CST) to the first cpp
token
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #9 from dodji at seketeli dot org dodji at seketeli dot org
2012-05-24 18:38:40 UTC ---
manu at gcc dot gnu.org gcc-bugzi...@gcc.gnu.org a écrit:
So either one keeps track of all source locations of all interesting
characters
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #10 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-24
19:05:26 UTC ---
(In reply to comment #9)
manu at gcc dot gnu.org gcc-bugzi...@gcc.gnu.org a écrit:
So either one keeps track of all source locations of all
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #11 from dodji at seketeli dot org dodji at seketeli dot org
2012-05-24 20:30:10 UTC ---
manu at gcc dot gnu.org gcc-bugzi...@gcc.gnu.org a écrit:
With the current infrastructure, I fear we cannot re-process the format
string
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #5 from Jakub Jelinek jakub at gcc dot gnu.org 2012-05-22
08:29:08 UTC ---
The format string could be even something like
void f() {
__builtin_printf(
u8Rabcd(%.)abcd
*d);
}
So,
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #6 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-22
09:54:29 UTC ---
(In reply to comment #3)
What does clang report for this:
#include stdio.h
void f() {
printf(
%.
*d);
}
?
/tmp/webcompile/_2090_0.c:5:2:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #7 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-22
10:55:49 UTC ---
(In reply to comment #5)
The format string could be even something like
void f() {
__builtin_printf(
u8Rabcd(%.)abcd
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #8 from Manuel López-Ibáñez manu at gcc dot gnu.org 2012-05-22
11:04:41 UTC ---
(In reply to comment #3)
What does clang report for this:
#include stdio.h
void f() {
printf(
%.
*d);
}
?
An even more interesting example
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #3 from Steven Bosscher steven at gcc dot gnu.org 2012-05-21
23:15:31 UTC ---
What does clang report for this:
#include stdio.h
void f() {
printf(
%.
*d);
}
?
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #4 from Steven Bosscher steven at gcc dot gnu.org 2012-05-21
23:21:04 UTC ---
Created attachment 27466
-- http://gcc.gnu.org/bugzilla/attachment.cgi?id=27466
Pass around the location of the format string
First, admittedly rather
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
--- Comment #2 from Steven Bosscher steven at gcc dot gnu.org 2012-05-17
21:19:28 UTC ---
To fix this properly, the input location should be tracked for the format
string. The location of the format string as argument to printf is available in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Steven Bosscher steven at gcc dot gnu.org changed:
What|Removed |Added
CC||steven at gcc
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52952
Manuel López-Ibáñez manu at gcc dot gnu.org changed:
What|Removed |Added
Keywords||diagnostic
55 matches
Mail list logo