How to crash your compiler with a one-liner, in two easy lessons (16.1.2006)

Just to prove that I'm not a Windows-only guy, here's an amusing HP-UX interlude. The following code resulted from frantic coding activity in a semi-functional terminal window:

  static int static int;

Compiling this nonsense via aCC foo.cpp leads to amusing results:

$aCC foo.cpp
( 0)  0x00269b54   toolError__12ErrorHandlerF11StringTokenRC8Positione + 0x58  [
/opt/aCC/lbin/ctcom.pa20]
( 1)  0x0025d164   __assertprint__FPCcT1i + 0x40  [/opt/aCC/lbin/ctcom.pa20]
( 2)  0x002a5b08   id__4NodeCFv + 0x30  [/opt/aCC/lbin/ctcom.pa20]
( 3)  0x0017dd88   doReduction1__FiR12ScannerValueP12ScannerValue + 0x3240  [/op
t/aCC/lbin/ctcom.pa20]
( 4)  0x0018281c   yyparse__Fv + 0xc44  [/opt/aCC/lbin/ctcom.pa20]
( 5)  0x002271d4   DoCompile__8CompilerFv + 0x228  [/opt/aCC/lbin/ctcom.pa20]
( 6)  0x000aadac   DoCompile__8CompilerFP6Buffer + 0x34  [/opt/aCC/lbin/ctcom.pa
20]
( 7)  0x000b067c   DoCompileFile__8CompilerFPc + 0x25c  [/opt/aCC/lbin/ctcom.pa2
0]
( 8)  0x00230ec4   main + 0x694  [/opt/aCC/lbin/ctcom.pa20]
( 9)  0xc0143478   _start + 0xc0  [/usr/lib/libc.2]
(10)  0x00155ce4   $START$ + 0x1a4  [/opt/aCC/lbin/ctcom.pa20]
Error (internal problem) 200: "foo.cpp", line 1 # Assertion failed at [File
    "Node.C"; Line 558].
    static int static int;
    ^^^^^^^^^^^^^^^^^^^^^

The other one-liner which I remember also used to kill the C++ compiler on HP-UX:

  char *p = (char *)0x80000000;

With current versions of aCC, this works as expected, so I cannot present a stacktrace here, but I do remember that we debugged into the issue and found that, for unknown reasons, the compiler tried to dereference the pointer address, and then crashed miserably...


When asked for a TWiki account, use your own or the default TWikiGuest account.


Revision: r1.1 - 17 Feb 2006 - 20:54 - ClausBrod
Blog > BlogOnSoftware20060116
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback