public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/64186] New: Conversion of signed to unsigned of same rank not performed
@ 2014-12-04 19:10 michael.chapman at cortus dot com
2014-12-04 19:14 ` [Bug c/64186] " pinskia at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: michael.chapman at cortus dot com @ 2014-12-04 19:10 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64186
Bug ID: 64186
Summary: Conversion of signed to unsigned of same rank not
performed
Product: gcc
Version: 4.9.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: michael.chapman at cortus dot com
Created attachment 34192
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34192&action=edit
Test case which should return 0, but returns 1
I believe the attached test program should return 0 from main. However, it
returns 1.
This seems to be a common front end problem which applies to many versions of
the compiler.
Tested on:-
gcc-4.6 (Ubuntu/Linaro 4.6.4-1ubuntu1~12.04) 4.6.4
and
aps-gcc (GCC) 4.9.2 20141128 (Cortus)
Adding an explicit cast of (unsigned short) just before x (as indicated in the
comment in the attached test case) in the divide produces the correct result.
My interpretation of the C99 conversion rules is that the conversion to
unsigned short is what should happen implicitly. The code generated seems to
suggest that an implicit conversion of x to signed int was performed.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/64186] Conversion of signed to unsigned of same rank not performed
2014-12-04 19:10 [Bug c/64186] New: Conversion of signed to unsigned of same rank not performed michael.chapman at cortus dot com
@ 2014-12-04 19:14 ` pinskia at gcc dot gnu.org
2014-12-04 19:28 ` michael.chapman at cortus dot com
2014-12-04 19:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-12-04 19:14 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64186
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
>My interpretation of the C99 conversion rules is that the conversion to unsigned short
You are incorrect, the conversion rules never convert to anything smaller than
int.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/64186] Conversion of signed to unsigned of same rank not performed
2014-12-04 19:10 [Bug c/64186] New: Conversion of signed to unsigned of same rank not performed michael.chapman at cortus dot com
2014-12-04 19:14 ` [Bug c/64186] " pinskia at gcc dot gnu.org
@ 2014-12-04 19:28 ` michael.chapman at cortus dot com
2014-12-04 19:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: michael.chapman at cortus dot com @ 2014-12-04 19:28 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64186
--- Comment #2 from Michael Chapman <michael.chapman at cortus dot com> ---
I think you are right. Geez you need to be a lawyer to understand this
sometimes.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c/64186] Conversion of signed to unsigned of same rank not performed
2014-12-04 19:10 [Bug c/64186] New: Conversion of signed to unsigned of same rank not performed michael.chapman at cortus dot com
2014-12-04 19:14 ` [Bug c/64186] " pinskia at gcc dot gnu.org
2014-12-04 19:28 ` michael.chapman at cortus dot com
@ 2014-12-04 19:32 ` mpolacek at gcc dot gnu.org
2 siblings, 0 replies; 4+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-12-04 19:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64186
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |mpolacek at gcc dot gnu.org
Resolution|--- |INVALID
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Invalid.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-04 19:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04 19:10 [Bug c/64186] New: Conversion of signed to unsigned of same rank not performed michael.chapman at cortus dot com
2014-12-04 19:14 ` [Bug c/64186] " pinskia at gcc dot gnu.org
2014-12-04 19:28 ` michael.chapman at cortus dot com
2014-12-04 19:32 ` 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).