public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c/6515: incorrect bitfield promotion
@ 2002-04-30  2:16 ms
  0 siblings, 0 replies; 2+ messages in thread
From: ms @ 2002-04-30  2:16 UTC (permalink / raw)
  To: gcc-gnats


>Number:         6515
>Category:       c
>Synopsis:       incorrect bitfield promotion
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 30 02:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     ms@siroyan.com
>Release:        3.0.4
>Organization:
>Environment:
i686-pc-linux-gnu
>Description:
In the attached example test1() and test2() both
perform a % operation. I expected an unsigned mod
operation performed in both cases, in practice it only
occurs in the second case, in the former case the
(unsigned int)cast appears to have no effect.

I expected:
* x.b cast to (unsigned int)
* x.a promoted to int by integral promotion
* x.a converted to (unsigned int), by arithmetic conversion
to bring x.a x.b to a common type.
* unsigned mod applied to x.a and x.b
>How-To-Repeat:
gcc -O2 x.c
./a.out
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="x.c"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="x.c"

c3RydWN0IHsKICBpbnQgYTo3OwogIHVuc2lnbmVkIGludCBiOjY7Cn0geDsKCnVuc2lnbmVkIGlu
dCBhYSwgYmI7Cgppbml0ICgpCnsKICBhYSA9IHguYSA9IC0xMzsKICBiYiA9IHguYiA9IDYxOwp9
CgptYWluICgpCnsKICBpbml0ICgpOwogIHRlc3QxICgpOwogIHRlc3QyICgpOwp9Cgp0ZXN0MSAo
KQp7CiAgcHJpbnRmICgiJWQgJSUgJWQgPSAlZFxuIiwgeC5hLCB4LmIsIHguYSAlICgodW5zaWdu
ZWQgaW50KSB4LmIpKTsKfQoKdGVzdDIgKCkKewogIHByaW50ZiAoIiVkICUlICVkID0gJWRcbiIs
IGFhLCBiYiwgYWEgJSBiYik7Cn0K


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

* Re: c/6515: incorrect bitfield promotion
@ 2002-05-22  5:09 neil
  0 siblings, 0 replies; 2+ messages in thread
From: neil @ 2002-05-22  5:09 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, ms, neil, nobody

Synopsis: incorrect bitfield promotion

Responsible-Changed-From-To: unassigned->neil
Responsible-Changed-By: neil
Responsible-Changed-When: Wed May 22 05:09:19 2002
Responsible-Changed-Why:
    Bitfield issues are assigned to me, though I doubt I'll
    have time to fix them until 3.3.
State-Changed-From-To: open->analyzed
State-Changed-By: neil
State-Changed-When: Wed May 22 05:09:19 2002
State-Changed-Why:
    Bitfields have several issues, fundamentally down to the
    single fact that their type is not represented properly in the
    compiler.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6515


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

end of thread, other threads:[~2002-05-22 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-30  2:16 c/6515: incorrect bitfield promotion ms
2002-05-22  5:09 neil

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