public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/30260] Enumeration types and enumeration constants erroneously given unsigned types
Date: Tue, 19 Dec 2006 21:06:00 -0000	[thread overview]
Message-ID: <20061219210555.5421.qmail@sourceware.org> (raw)
In-Reply-To: <bug-30260-13661@http.gcc.gnu.org/bugzilla/>



------- Comment #1 from pinskia at gcc dot gnu dot org  2006-12-19 21:05 -------
C99 6.7.2.2 does not say that.

Read 6.7.2.2 which says:
> The expression that defines the value of an enumeration constant shall be an
> integer constant expression that has a value representable as an int.

So the error with -pedantic is correct as 0U - 1 is not representable as an
int.

Also:
Read 6.7.2.2/4 which says:
> Each enumerated type shall be compatible with char, a signed integer type, or an
> unsigned integer type. The choice of type is implementation-defined,108) but 
> shall be capable of representing the values of all the members of the
> enumeration. The enumerated type is incomplete until after the } that
> terminates the list of enumerator declarations.

http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Structures-unions-enumerations-and-bit_002dfields-implementation.html
Specifies our implementation-defined behavior.


Now we do have different code with -pedantic and without -pedantic and that is
a bug but that is PR 15236.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30260


  reply	other threads:[~2006-12-19 21:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-19 20:51 [Bug c/30260] New: " rda at lemma-one dot com
2006-12-19 21:06 ` pinskia at gcc dot gnu dot org [this message]
2006-12-19 21:22 ` [Bug c/30260] " joseph at codesourcery dot com
2006-12-19 21:23 ` jsm28 at gcc dot gnu dot org
2008-02-12 14:26 ` manu at gcc dot gnu dot org
2008-02-15 11:26 ` manu at gcc dot gnu dot org
2008-08-23 18:21 ` manu at gcc dot gnu dot org
2008-08-24 14:03 ` rda at lemma-one dot com
2008-10-19 13:54 ` manu at gcc dot gnu dot org
2008-10-19 13:56 ` manu at gcc dot gnu dot org

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

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

  git send-email \
    --in-reply-to=20061219210555.5421.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.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).