Google

Fastest way to crash the VC++ compiler

A place for Ogre users to discuss non-Ogre subjects with friends from the community.

Moderators: Moderators, OGRE Team

Fastest way to crash the VC++ compiler

Postby Bekas » Sun Oct 05, 2008 3:55 am

Just use this line (valid C++):
Code: Select all
class {} (x);

And the shortest "crasher":
Code: Select all
class{}(

Just 8 characters. I challenge you to crash VC++ with less than 8 chars :)
MOGRE (Managed OGRE) - Advanced .NET wrapper for Ogre
Bekas
OGRE Expert User
OGRE Expert User
 
Posts: 263
Joined: Sat Oct 16, 2004 11:21 pm
Location: Greece

Postby johnhpus » Sun Oct 05, 2008 4:11 am

I guess you mean the compiler has an error, or?

What version btw?
User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
 
Posts: 1248
Joined: Sat Apr 17, 2004 2:49 am

Postby Kojack » Sun Oct 05, 2008 6:10 am

Just use this line (valid C++):

That's valid c++? What on earth is it supposed to do?
User avatar
Kojack
OGRE Moderator
OGRE Moderator
 
Posts: 3135
Joined: Sun Jan 25, 2004 7:35 am
Location: Australia

Postby Halifax » Sun Oct 05, 2008 7:51 am

Kojack wrote:
Just use this line (valid C++):

That's valid c++? What on earth is it supposed to do?


I'm guessing it's synonymous with the valid C++ declaration for a structure of size 0, and it defines an instance named 'x'. I really don't know what it's meant for, but I know GCC supports it. At least that's what I remember reading somewhere.
User avatar
Halifax
Familiar face
 
Posts: 49
Joined: Sun Nov 18, 2007 10:30 pm

Postby Klaim » Sun Oct 05, 2008 12:05 pm

I've encoutered cases where vc9 and vc8 crashes but can't remember how. I think it involved template code.
User avatar
Klaim
Veteran
 
Posts: 1174
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France

Postby Bekas » Sun Oct 05, 2008 1:04 pm

johnhpus wrote:I guess you mean the compiler has an error, or?

What version btw?

Crashes as in when you try to compile a "Microsoft (R) C/C++ Optimizing Compiler has encountered a problem and needs to close. We are sorry for the inconvenience." window pops up.

Tested on 7.1, 8, and 9 versions.

Kojack wrote:
Just use this line (valid C++):

That's valid c++? What on earth is it supposed to do?

Declares a variable 'x' with anonymous type 'class {}'. It's similar to this:
Code: Select all
struct { int a; } x;

But with redundant parentheses around x.
MOGRE (Managed OGRE) - Advanced .NET wrapper for Ogre
Bekas
OGRE Expert User
OGRE Expert User
 
Posts: 263
Joined: Sat Oct 16, 2004 11:21 pm
Location: Greece

Postby johnhpus » Sun Oct 05, 2008 1:08 pm

Well that's something. I've had internal compiler errors before but never even heard of code crashing the entire application. That's quite a find.
User avatar
johnhpus
Platinum Sponsor
Platinum Sponsor
 
Posts: 1248
Joined: Sat Apr 17, 2004 2:49 am

Postby nullsquared » Sun Oct 05, 2008 1:45 pm

Oh :lol: this is hilarious.

Visual Studio 2008, now with improved download size and better crash rates. Get your copy today!
User avatar
nullsquared
OGRE Expert User
OGRE Expert User
 
Posts: 3255
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA

Postby Klaim » Sun Oct 05, 2008 2:41 pm

johnhpus> It only crashes the compiler execution, so if you're using visual studio it don't crash all the ide, only interrupt the code compilation.
User avatar
Klaim
Veteran
 
Posts: 1174
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France

Postby Bekas » Sun Oct 05, 2008 2:56 pm

And while we are on the subject, does anybody have any GCC "crashers" ?

This is not a crasher but here's a weird behavior from GCC:
Code: Select all
void f() {
  typedef int SomeType;
  int (x)[SomeType];  // no error from GCC!
}
MOGRE (Managed OGRE) - Advanced .NET wrapper for Ogre
Bekas
OGRE Expert User
OGRE Expert User
 
Posts: 263
Joined: Sat Oct 16, 2004 11:21 pm
Location: Greece

Postby Klaim » Mon Oct 06, 2008 12:17 am

Wow, strange...
User avatar
Klaim
Veteran
 
Posts: 1174
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France

Postby nullsquared » Mon Oct 06, 2008 3:30 am

Talk about weird code...
Code: Select all
class _{}(x);main(){_(x)[_];}

Compiles fine under GCC 3.4.1.
User avatar
nullsquared
OGRE Expert User
OGRE Expert User
 
Posts: 3255
Joined: Tue Apr 24, 2007 8:23 pm
Location: NY, NY, USA

Re: Fastest way to crash the VC++ compiler

Postby Berserker » Mon Oct 06, 2008 8:50 am

Bekas wrote:Just 8 characters. I challenge you to crash VC++ with less than 8 chars :)


Code: Select all
enum{}(


I won :D :D :D



P.S.: tested on VC2005/VC2008
User avatar
Berserker
Familiar face
 
Posts: 40
Joined: Sat May 01, 2004 3:41 pm

Re: Fastest way to crash the VC++ compiler

Postby PolyVox » Mon Oct 06, 2008 5:46 pm

Berserker wrote:
Bekas wrote:Just 8 characters. I challenge you to crash VC++ with less than 8 chars :)


Code: Select all
enum{}(


I won :D :D :D

P.S.: tested on VC2005/VC2008


Confirmed :D This thread is genius...
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
 
Posts: 1174
Joined: Tue Nov 21, 2006 11:28 am
Location: Derby, UK

Postby Klaim » Mon Oct 06, 2008 9:40 pm

Err....i don't understand...it don't crash here...

did you install the VS SP1? i did.
User avatar
Klaim
Veteran
 
Posts: 1174
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France

Postby PolyVox » Mon Oct 06, 2008 9:51 pm

Klaim wrote:Err....i don't understand...it don't crash here...

did you install the VS SP1? i did.

I'm on VS2005, with SP1 and the Vista patch. I created a Win32 console app, put in that line of code, and got an internal compiler error. The IDE survived, though.
User avatar
PolyVox
OGRE Contributor
OGRE Contributor
 
Posts: 1174
Joined: Tue Nov 21, 2006 11:28 am
Location: Derby, UK

Postby Klaim » Mon Oct 06, 2008 11:05 pm

Ah yes, VS2005 SP1 + XP here and it crases :)

But on VS2008 SP1 + XP (and maybe minor updates via Windows Update) it don't...
User avatar
Klaim
Veteran
 
Posts: 1174
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France

Postby pjcast » Tue Oct 07, 2008 2:33 am

I don't have anyways to crash the compiler. But crashing the Form Designer is pretty easy with CLI/C++.. at least from what I've seen.

* Method 1: Have a nested enum in a C# assembly UserControl also used as a property of that Control. Caused a Designer out of memory exception while trying to load the control in designer when the control used in a CLI WinForm class.

* Method 2: open a CLI Winform class in the designer, than edit the .h file. Designer will crash on that form until you restart visual studio.
Have a question about Input? Video? WGE? Come on over... http://www.wreckedgames.com/forum/
User avatar
pjcast
OGRE Team Member
OGRE Team Member
 
Posts: 2942
Joined: Fri Oct 24, 2003 2:53 am
Location: San Diego, Ca

Re: Fastest way to crash the VC++ compiler

Postby Bekas » Tue Oct 07, 2008 2:57 am

Berserker wrote:
Code: Select all
enum{}(


I won :D :D :D

Yey! We have a winner! :)
MOGRE (Managed OGRE) - Advanced .NET wrapper for Ogre
Bekas
OGRE Expert User
OGRE Expert User
 
Posts: 263
Joined: Sat Oct 16, 2004 11:21 pm
Location: Greece


Return to Lounge / Off-topic

Who is online

Users browsing this forum: No registered users and 2 guests

cron