bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
* parse-datetime.y reports integer overflow when compiled with gcc 5.5.0
@ 2021-01-08 14:37 Sergey Poznyakoff
  2021-01-08 21:49 ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Sergey Poznyakoff @ 2021-01-08 14:37 UTC (permalink / raw)
  To: bug-gnulib

Hello,

With recent gnulib (v0.1-4336-gbdae9a5), attempting to compile
parse-datetime.c fails with:

$ make -k parse-datetime.o V=1
gcc -DHAVE_CONFIG_H -I. -I..     -Wall -ggdb -MT parse-datetime.o -MD -MP -MF .deps/parse-datetime.Tpo -c -o parse-datetime.o parse-datetime.c
In file included from parse-datetime.y:39:0:
parse-datetime.y: In function 'to_tm_year':
intprops.h:578:17: warning: integer overflow in expression [-Woverflow]
       || (tmax) + (b) < (a)))
                 ^
intprops.h:524:4: note: in expansion of macro '_GL_INT_SUBTRACT_RANGE_OVERFLOW'
   (overflow (a, b, tmin, tmax) \
    ^
intprops.h:491:10: note: in expansion of macro '_GL_INT_OP_CALC'
        ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned int, \
          ^
intprops.h:389:4: note: in expansion of macro '_GL_INT_OP_WRAPV'
    _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
    ^
parse-datetime.y:1274:9: note: in expansion of macro 'INT_SUBTRACT_WRAPV'
       : INT_SUBTRACT_WRAPV (year, TM_YEAR_BASE, tm_year))
         ^
parse-datetime.y: In function 'yylex':
intprops.h:578:17: warning: integer overflow in expression [-Woverflow]
       || (tmax) + (b) < (a)))
                 ^
intprops.h:524:4: note: in expansion of macro '_GL_INT_SUBTRACT_RANGE_OVERFLOW'
   (overflow (a, b, tmin, tmax) \
    ^
intprops.h:500:11: note: in expansion of macro '_GL_INT_OP_CALC'
         ? _GL_INT_OP_CALC (a, b, r, op, overflow, unsigned long int, \
           ^
intprops.h:495:7: note: in expansion of macro '_GL_INT_OP_WRAPV_LONGISH'
     : _GL_INT_OP_WRAPV_LONGISH(a, b, r, op, overflow))
       ^
intprops.h:389:4: note: in expansion of macro '_GL_INT_OP_WRAPV'
    _GL_INT_OP_WRAPV (a, b, r, -, _GL_INT_SUBTRACT_RANGE_OVERFLOW)
    ^
parse-datetime.y:1469:23: note: in expansion of macro 'INT_SUBTRACT_WRAPV'
                   if (INT_SUBTRACT_WRAPV (s, 1, &s))
                       ^

Bisecting shows that the bug was introduced by commit 55168f5fa7b3b95fbaa2be525b15f6ecd5500c02
		       
Regards,
Sergey


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-01-08 22:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-08 14:37 parse-datetime.y reports integer overflow when compiled with gcc 5.5.0 Sergey Poznyakoff
2021-01-08 21:49 ` Bruno Haible
2021-01-08 22:00   ` Paul Eggert

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).