public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: Nilmoni Deb <ndeb@ece.cmu.edu> To: gcc-bugs@gcc.gnu.org Subject: g++ delete issue Date: Tue, 06 Apr 2004 03:57:00 -0000 [thread overview] Message-ID: <40722AA9.8010608@ece.cmu.edu> (raw) "gcc -v" Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/specs Configured with: ../configure --prefix=/usr --libdir=/usr/lib --with-slibdir=/lib --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --enable-long-long --enable-__cxa_atexit --enable-languages=c,c++,ada,f77,objc,java,pascal --host=i586-mandrake-linux-gnu --with-system-zlib Thread model: posix gcc version 3.3.1 (Mandrake Linux 9.2 3.3.1-2mdk) The following C++ program compiles ok without any warning, when I use "g++ -g file.cpp" . #include <iostream> using namespace std; int main() { int u=3; cout << "u = " << u << endl; delete &u; return 0; } During runtime, the program segmentation faults after printing the value of u. The culprit is obviously the "delete" statement. My concern is that the compiler allows the explicit "delete &u" operation even though the variable u is not user allocated. Should the compiler be expected to give a warning/error message when such a statement appears ? thanks...
next reply other threads:[~2004-04-06 3:57 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2004-04-06 3:57 Nilmoni Deb [this message] 2004-04-08 2:22 ` Jim Wilson 2004-04-08 3:42 ` Nilmoni Deb
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=40722AA9.8010608@ece.cmu.edu \ --to=ndeb@ece.cmu.edu \ --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: linkBe 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).