public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/18314] New: Abnormal behavior in optimization
@ 2004-11-05 23:57 lamshuyin at netvigator dot com
  2004-11-17 13:08 ` [Bug c/18314] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: lamshuyin at netvigator dot com @ 2004-11-05 23:57 UTC (permalink / raw)
  To: gcc-bugs

For this program, -O2 will create an infinite loop:

int test=0;
void main(void)
{
   while((volatile int)test!=0);
}

If "volatile int" is not allowed, there should be at least some warning or 
error, but it compiles successfully.

-- 
           Summary: Abnormal behavior in optimization
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lamshuyin at netvigator dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386
  GCC host triplet: i386
GCC target triplet: ARM


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


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

* [Bug c/18314] Abnormal behavior in optimization
  2004-11-05 23:57 [Bug c/18314] New: Abnormal behavior in optimization lamshuyin at netvigator dot com
@ 2004-11-17 13:08 ` pinskia at gcc dot gnu dot org
  2004-11-17 13:45 ` schwab at suse dot de
  2004-11-17 15:46 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-17 13:08 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-17 13:08 -------
I think you want:
*(volatile int*)&test

volatile only matters on pointers and types of variables and not casts IIRC.

-- 


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


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

* [Bug c/18314] Abnormal behavior in optimization
  2004-11-05 23:57 [Bug c/18314] New: Abnormal behavior in optimization lamshuyin at netvigator dot com
  2004-11-17 13:08 ` [Bug c/18314] " pinskia at gcc dot gnu dot org
@ 2004-11-17 13:45 ` schwab at suse dot de
  2004-11-17 15:46 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: schwab at suse dot de @ 2004-11-17 13:45 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From schwab at suse dot de  2004-11-17 13:45 -------
6.7.3#3: The properties associated with qualified types are meaningful only 
for expressions that are lvalues. 
 
This is not a constraint, so not an error. 

-- 


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


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

* [Bug c/18314] Abnormal behavior in optimization
  2004-11-05 23:57 [Bug c/18314] New: Abnormal behavior in optimization lamshuyin at netvigator dot com
  2004-11-17 13:08 ` [Bug c/18314] " pinskia at gcc dot gnu dot org
  2004-11-17 13:45 ` schwab at suse dot de
@ 2004-11-17 15:46 ` pinskia at gcc dot gnu dot org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-11-17 15:46 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-11-17 15:46 -------
So this is invalid so closing.

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


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


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

end of thread, other threads:[~2004-11-17 15:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-05 23:57 [Bug c/18314] New: Abnormal behavior in optimization lamshuyin at netvigator dot com
2004-11-17 13:08 ` [Bug c/18314] " pinskia at gcc dot gnu dot org
2004-11-17 13:45 ` schwab at suse dot de
2004-11-17 15:46 ` pinskia at gcc dot gnu dot 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).