bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Sergey Poznyakoff <gray@gnu.org.ua>
To: <bug-gnulib@gnu.org>
Subject: parse-datetime.y reports integer overflow when compiled with gcc 5.5.0
Date: Fri, 08 Jan 2021 16:37:02 +0200	[thread overview]
Message-ID: <20210108163702.27423@ulysses.gnu.org.ua> (raw)

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


             reply	other threads:[~2021-01-08 14:37 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-08 14:37 Sergey Poznyakoff [this message]
2021-01-08 21:49 ` parse-datetime.y reports integer overflow when compiled with gcc 5.5.0 Bruno Haible
2021-01-08 22:00   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210108163702.27423@ulysses.gnu.org.ua \
    --to=gray@gnu.org.ua \
    --cc=bug-gnulib@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).