public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/32786]  New: Incorrect code compiles and runs well
@ 2007-07-17  2:23 bachmann dot matt at gmail dot com
  2007-07-17  3:17 ` [Bug c++/32786] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: bachmann dot matt at gmail dot com @ 2007-07-17  2:23 UTC (permalink / raw)
  To: gcc-bugs

This is my first bug report... I am not quite sure what you mean by
host/target/build triplet so ill give you what I can

complied on an 686 architecture in linux. 

#include<iostream>
#include<cstdlib>
using namespace std;

/**
 * Matt Bachmann
 * CS 331
 * HW1 Due: July 9th 2007
 * Main method shows different ways of traversing strings
 */ 
int main() {
        char mary[25] = "Mary had a little lamb.";
        char* moby = "Thar she blows!";

        cout << strlen(mary) << endl << endl;
        for(unsigned int i = 0; i < strlen(mary); i++) {
                for(unsigned int a = i; a < strlen(mary); a++) {
                        cout << mary[a];
                }
                cout << endl;
        }
        cout << endl;
        cout << strlen(moby) << endl << endl;
        while(moby != '\0') { 
                cout << moby << endl;
                moby++;
        }
        system("PAUSE");
        return EXIT_SUCCESS;
}

the condition in the while loop should cause an infinite loop and should be
moby*


-- 
           Summary: Incorrect code compiles and runs well
           Product: gcc
           Version: 4.1.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bachmann dot matt at gmail dot com


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


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

end of thread, other threads:[~2007-07-17  4:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-17  2:23 [Bug c++/32786] New: Incorrect code compiles and runs well bachmann dot matt at gmail dot com
2007-07-17  3:17 ` [Bug c++/32786] " pinskia at gcc dot gnu dot org
2007-07-17  3:39 ` bachmann dot matt at gmail dot com
2007-07-17  3:58 ` pinskia at gcc dot gnu dot org
2007-07-17  4:04 ` bachmann dot matt at gmail dot com

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