https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69543

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Breakpoint 4, linemap_compare_locations (set=0x7ffff7ff6000, pre=2147483641,
post=post@entry=2147483656) at ../../src/libcpp/line-map.c:1326

(gdb) call inform (2147483641, "pre=2147483641")
../../src/gcc/testsuite/c-c++-common/pr69453.c: In function ‘test’:
../../src/gcc/testsuite/c-c++-common/pr69453.c:6:5: note: pre=2147483641
     _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
     ^
../../src/gcc/testsuite/c-c++-common/pr69453.c:13:3: note: in expansion of
macro ‘YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN’
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   ^
(gdb) p /x 2147483641
$15 = 0x7ffffff9

(gdb) call inform (2147483656, "post=2147483656")
../../src/gcc/testsuite/c-c++-common/pr69453.c:14:12: note: post=2147483656
   *++yyvsp = yylval;
   ~~~~~~~~~^~~~~~~~
(gdb) p /x 2147483656
$8 = 0x80000008

(gdb) p l0
$16 = 2147483641
(gdb) p l1
$17 = 312096
(gdb) p /x l0
$18 = 0x7ffffff9

Then, after the call to:
1338      if ((pre_virtual_p = linemap_location_from_macro_expansion_p (set,
l0)))
1339        l0 = linemap_resolve_location (set, l0,
1340                                       LRK_MACRO_EXPANSION_POINT,
1341                                       NULL);
1342    
we have:
(gdb) p /x l0
$21 = 0x80000004

so we have a comparison of locations, one (l0) from a macro expansion, the
other not (l1).

linemap_compare_locations concludes by executing this:
1368      return l1 - l0;
giving this rather nonsensical result:
Value returned is $25 = -2147171556

If I'm reading this right, it thus regards the "ignored" as happening *after*
the source line of interest, hence the latter erroneously isn't affected by the
_Pragma.

Reply via email to