public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1
@ 2014-07-25 7:56 zeccav at gmail dot com
2014-07-25 8:03 ` [Bug c/61903] " zeccav at gmail dot com
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2014-07-25 7:56 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61903
Bug ID: 61903
Summary: signed integer overflow in expmed.c
store_fixed_bit_filed_1
Product: gcc
Version: 4.9.1
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: zeccav at gmail dot com
Compiling testsuite code pr28045.c the sanitizer claims that a signed integer
overflow occurs at expmed.c:1071
"../../gcc-4.9.1/gcc/expmed.c:1071:41: runtime error: signed integer overflow:
-9223372036854775808 + -1 cannot be represented in type 'long int'"
The offending instruction is
"v &= ((HOST_WIDE_INT) 1 << bitsize) - 1;"
This is in store_fixed_bit_field_1 on x86-64.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c/61903] signed integer overflow in expmed.c store_fixed_bit_filed_1
2014-07-25 7:56 [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1 zeccav at gmail dot com
@ 2014-07-25 8:03 ` zeccav at gmail dot com
2014-07-25 8:10 ` [Bug middle-end/61903] " pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: zeccav at gmail dot com @ 2014-07-25 8:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61903
--- Comment #1 from Vittorio Zecca <zeccav at gmail dot com> ---
Same runtime error at line 1076 of expmed.c
"&& v == ((HOST_WIDE_INT) 1 << bitsize) - 1)"
compiling pr28045.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61903] signed integer overflow in expmed.c store_fixed_bit_filed_1
2014-07-25 7:56 [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1 zeccav at gmail dot com
2014-07-25 8:03 ` [Bug c/61903] " zeccav at gmail dot com
@ 2014-07-25 8:10 ` pinskia at gcc dot gnu.org
2014-09-01 9:19 ` mpolacek at gcc dot gnu.org
2014-09-01 9:22 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-07-25 8:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61903
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2014-07-25
Component|c |middle-end
Ever confirmed|0 |1
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
if (bitsize < HOST_BITS_PER_WIDE_INT)
v &= ((HOST_WIDE_INT) 1 << bitsize) - 1;
Should be an easy fix to change HOST_WIDE_INT to unsigned HOST_WIDE_INT.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61903] signed integer overflow in expmed.c store_fixed_bit_filed_1
2014-07-25 7:56 [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1 zeccav at gmail dot com
2014-07-25 8:03 ` [Bug c/61903] " zeccav at gmail dot com
2014-07-25 8:10 ` [Bug middle-end/61903] " pinskia at gcc dot gnu.org
@ 2014-09-01 9:19 ` mpolacek at gcc dot gnu.org
2014-09-01 9:22 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-01 9:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61903
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Mon Sep 1 09:18:43 2014
New Revision: 214781
URL: https://gcc.gnu.org/viewcvs?rev=214781&root=gcc&view=rev
Log:
PR middle-end/61903
* expmed.c (store_fixed_bit_field_1): Shift UHWI 1 instead of HWI 1.
Change the type of V to unsigned HOST_WIDE_INT.
Modified:
trunk/gcc/ChangeLog
trunk/gcc/expmed.c
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug middle-end/61903] signed integer overflow in expmed.c store_fixed_bit_filed_1
2014-07-25 7:56 [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1 zeccav at gmail dot com
` (2 preceding siblings ...)
2014-09-01 9:19 ` mpolacek at gcc dot gnu.org
@ 2014-09-01 9:22 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-09-01 9:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61903
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |FIXED
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Target Milestone|--- |5.0
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-09-01 9:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-25 7:56 [Bug c/61903] New: signed integer overflow in expmed.c store_fixed_bit_filed_1 zeccav at gmail dot com
2014-07-25 8:03 ` [Bug c/61903] " zeccav at gmail dot com
2014-07-25 8:10 ` [Bug middle-end/61903] " pinskia at gcc dot gnu.org
2014-09-01 9:19 ` mpolacek at gcc dot gnu.org
2014-09-01 9:22 ` mpolacek at gcc dot gnu.org
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).