public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/61185] New: Wrong value in error message
@ 2014-05-14 10:07 mpolacek at gcc dot gnu.org
2014-05-14 10:08 ` [Bug sanitizer/61185] " mpolacek at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-14 10:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61185
Bug ID: 61185
Summary: Wrong value in error message
Product: gcc
Version: 4.10.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: sanitizer
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
CC: dodji at gcc dot gnu.org, dvyukov at gcc dot gnu.org,
jakub at gcc dot gnu.org, kcc at gcc dot gnu.org
int
main ()
{
unsigned i = 32, j = 40;
int u = 9;
u <<= i - j;
}
with -fsanitize=shift says
s.c:6:5: runtime error: shift exponent -8 is negative
but it should say
s.c:6:5: runtime error: shift exponent 4294967288 is too large for 32-bit type
'int'
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/61185] Wrong value in error message
2014-05-14 10:07 [Bug sanitizer/61185] New: Wrong value in error message mpolacek at gcc dot gnu.org
@ 2014-05-14 10:08 ` mpolacek at gcc dot gnu.org
2014-05-14 10:09 ` jakub at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-14 10:08 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61185
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.10.0
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
And the reason is that we convert the (i - j) to int here:
10501 /* Convert the non vector shift-count to an integer, regardless
10502 of size of value being shifted. */
10503 if (TREE_CODE (TREE_TYPE (op1)) != VECTOR_TYPE
10504 && TYPE_MAIN_VARIANT (TREE_TYPE (op1)) !=
integer_type_node)
10505 op1 = convert (integer_type_node, op1);
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/61185] Wrong value in error message
2014-05-14 10:07 [Bug sanitizer/61185] New: Wrong value in error message mpolacek at gcc dot gnu.org
2014-05-14 10:08 ` [Bug sanitizer/61185] " mpolacek at gcc dot gnu.org
@ 2014-05-14 10:09 ` jakub at gcc dot gnu.org
2014-05-14 10:13 ` jakub at gcc dot gnu.org
2014-05-14 10:58 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-05-14 10:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61185
--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
IMHO not a bug. The compiler really uses (int) (i - j) as the shiftcount, and
that is negative.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/61185] Wrong value in error message
2014-05-14 10:07 [Bug sanitizer/61185] New: Wrong value in error message mpolacek at gcc dot gnu.org
2014-05-14 10:08 ` [Bug sanitizer/61185] " mpolacek at gcc dot gnu.org
2014-05-14 10:09 ` jakub at gcc dot gnu.org
@ 2014-05-14 10:13 ` jakub at gcc dot gnu.org
2014-05-14 10:58 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2014-05-14 10:13 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61185
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
But, if you want to use the source type before this conversion, make sure to
also
test stuff like:
int
main ()
{
unsigned long long l = 0xffffffff00000001ULL;
volatile int u = 9;
u <<= l;
return 0;
}
where the shift count after (int) conversion is in range, while before the
conversion it is not (ILP32 and LP64 targets only here).
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug sanitizer/61185] Wrong value in error message
2014-05-14 10:07 [Bug sanitizer/61185] New: Wrong value in error message mpolacek at gcc dot gnu.org
` (2 preceding siblings ...)
2014-05-14 10:13 ` jakub at gcc dot gnu.org
@ 2014-05-14 10:58 ` mpolacek at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-14 10:58 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61185
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |INVALID
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Ok, I guess it's not worth it. Closing.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-05-14 10:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-14 10:07 [Bug sanitizer/61185] New: Wrong value in error message mpolacek at gcc dot gnu.org
2014-05-14 10:08 ` [Bug sanitizer/61185] " mpolacek at gcc dot gnu.org
2014-05-14 10:09 ` jakub at gcc dot gnu.org
2014-05-14 10:13 ` jakub at gcc dot gnu.org
2014-05-14 10:58 ` 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).