public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "prigault at oricom dot ca" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/27129] [4.1/4.2 Regression] ICE in get_expr_operands
Date: Wed, 12 Apr 2006 14:00:00 -0000	[thread overview]
Message-ID: <20060412140048.12878.qmail@sourceware.org> (raw)
In-Reply-To: <bug-27129-87@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from prigault at oricom dot ca  2006-04-12 14:00 -------
IMO, the line defining c should trigger an error message because it needs to
use c before creating the variable, or else undefined behaviour occurs.
This message could be:
 error: &#8216;c&#8217; was not declared in this scope
or:
 error: 'c' is used uninitialized

Consider:

$ more test.cc
#include <stdio.h>

static const float f = 1 - a;

int main(void)
{
    printf("%f\n", f);

    return 0;
}

$ g++ -Wall  -O2 -o test  test.cc
test.cc:3: error: &#8216;a&#8217; was not declared in this scope

$ more test1.cc
#include <stdio.h>

static const float f = 1 - f;

int main(void)
{
    printf("%f\n", f);

    return 0;
}

$ g++ -Wall  -O2 -o test1  test1.cc
$

There should be an error message there as well.


-- 

prigault at oricom dot ca changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |prigault at oricom dot ca


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


  parent reply	other threads:[~2006-04-12 14:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12  9:43 [Bug c++/27129] New: " jakub at gcc dot gnu dot org
2006-04-12 11:17 ` [Bug c++/27129] " reichelt at gcc dot gnu dot org
2006-04-12 14:00 ` prigault at oricom dot ca [this message]
2006-04-16 19:48 ` mmitchel at gcc dot gnu dot org
2006-04-18 16:12 ` bonzini at gnu dot org
2006-05-16 13:15 ` jakub at gcc dot gnu dot org
2006-05-25  2:40 ` mmitchel at gcc dot gnu dot org
2006-06-03 22:37 ` pinskia at gcc dot gnu dot org
2006-06-09  9:42 ` jakub at gcc dot gnu dot org
2007-04-29 14:55 ` reichelt at gcc dot gnu dot org
2007-04-29 14:55 ` reichelt 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=20060412140048.12878.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).