[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-09-13 Thread aldyh at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #11 from Aldy Hernandez  ---
Author: aldyh
Date: Wed Sep 13 16:20:27 2017
New Revision: 252253

URL: https://gcc.gnu.org/viewcvs?rev=252253&root=gcc&view=rev
Log:
PR c/81448
PR c/81306
* c-warn.c (warn_for_multistatement_macros): Prevent bogus
warnings.  Avoid walking MACRO_MAP_LOCATIONS.   

* c-c++-common/Wmultistatement-macros-13.c: New test.

Added:
branches/range-gen2/gcc/testsuite/c-c++-common/Wmultistatement-macros-13.c
Modified:
branches/range-gen2/gcc/c-family/c-warn.c
branches/range-gen2/gcc/c/ChangeLog
branches/range-gen2/gcc/testsuite/ChangeLog

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-08-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

Marek Polacek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #10 from Marek Polacek  ---
Should be fixed, too.

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-08-02 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #9 from Marek Polacek  ---
Author: mpolacek
Date: Wed Aug  2 11:56:54 2017
New Revision: 250822

URL: https://gcc.gnu.org/viewcvs?rev=250822&root=gcc&view=rev
Log:
PR c/81448
PR c/81306
* c-warn.c (warn_for_multistatement_macros): Prevent bogus
warnings.  Avoid walking MACRO_MAP_LOCATIONS.   

* c-c++-common/Wmultistatement-macros-13.c: New test.

Added:
trunk/gcc/testsuite/c-c++-common/Wmultistatement-macros-13.c
Modified:
trunk/gcc/c-family/c-warn.c
trunk/gcc/c/ChangeLog
trunk/gcc/testsuite/ChangeLog

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

Marek Polacek  changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
   Assignee|unassigned at gcc dot gnu.org  |mpolacek at gcc dot 
gnu.org

--- Comment #8 from Marek Polacek  ---
It works, so mine.

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-27 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #7 from Marek Polacek  ---
Actually, while fixing PR81448 I removed that hunk of code completely, so that
might fix this, too.  Will test this after the usual testing.

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

Marek Polacek  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2017-07-26
 Ever confirmed|0   |1

--- Comment #6 from Marek Polacek  ---
So, confirmed, but clueless.

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #5 from Marek Polacek  ---
And I wonder if that's what this comment in dump_location_info talks about:

1187   for (unsigned int i = 0; i < MACRO_MAP_NUM_MACRO_TOKENS (map); i++)
1188 {
1189   source_location x = MACRO_MAP_LOCATIONS (map)[2 * i];
1190   source_location y = MACRO_MAP_LOCATIONS (map)[(2 * i) + 1];
1191 
1192   /* linemap_add_macro_token encodes token numbers in an expansion
1193  by putting them after MAP_START_LOCATION. */
1194 
1195   /* I'm typically seeing 4 uninitialized entries at the end of
1196  0xafafafaf.
1197  This appears to be due to macro.c:replace_args
1198  adding 2 extra args for padding tokens; presumably there may
1199  be a leading and/or trailing padding token injected,
1200  each for 2 more location slots.
1201  This would explain there being up to 4 source_locations slots
1202  that may be uninitialized.  */

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-26 Thread mpolacek at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #4 from Marek Polacek  ---
I've reproduced the issue but don't know what to do about it, it doesn't seem
to be a bug in the warning.  I looks like the macro maps contains holes:

cc1: note: token 77 has x-location == y-location == 0
78: 0, 0
cc1: note: token 78 has x-location == y-location == 0
79: 0, 0
cc1: note: token 79 has x-location == y-location == 0
80: 0, 0
cc1: note: token 80 has x-location == y-location == 0
81: 0, 0
cc1: note: token 81 has x-location == y-location == 0
82: 0, 0
cc1: note: token 82 has x-location == y-location == 0
83: 0, 0
cc1: note: token 83 has x-location == y-location == 0
84: 0, 0
cc1: note: token 84 has x-location == y-location == 0
85: 0, 0
cc1: note: token 85 has x-location == y-location == 0
86: 0, 0
cc1: note: token 86 has x-location == y-location == 0
87: 0, 0
cc1: note: token 87 has x-location == y-location == 0
88: 0, 0
cc1: note: token 88 has x-location == y-location == 0
89: 0, 0
cc1: note: token 89 has x-location == y-location == 0
90: 0, 0
cc1: note: token 90 has x-location == y-location == 0

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-21 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #3 from David Binderman  ---
Problem still seems to exist a couple of weeks later in latest gcc.

Any progress ?

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-04 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #2 from David Binderman  ---
I've had a go at chopping down the command line and got this:

$ pwd
/home/dcb/gcc/working/x86_64-pc-linux-gnu/libgcc

$ /home/dcb/gcc/working/./gcc/xgcc -B/home/dcb/gcc/working/./gcc/ -Wall -I.
-I../../../trunk/libgcc/. -I../../../trunk/include -c
../../../trunk/libgcc/soft-fp/divtf3.c

Using -E and capturing the preprocessor output in a temporary file and
then compiling that doesn't seem to work.

[Bug c/81306] valgrind error for function warn_for_multistatement_macros in file c-warn.c line 2474

2017-07-04 Thread dcb314 at hotmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81306

--- Comment #1 from David Binderman  ---
Problem occurs when libgcc/soft-fp/divtf3.c is being compiled.