SWP-Ubau-SoSe2014-Haskell / SWPSoSe14

Rail compiler written in Haskell
MIT License
3 stars 1 forks source link

String cut (c): error handling #158

Closed cpockrandt closed 10 years ago

cpockrandt commented 10 years ago

The following rail program results in a crash. Maybe we can catch invalid inputs and output a (helpful) error message?

$ 'main' (--):
 \        
  \-[abc]-[-1]-c-o-#
0  libLLVM-3.4.so.1 0x00007f68dcabc5d2 llvm::sys::PrintStackTrace(_IO_FILE*) +
34\n1  libLLVM-3.4.so.1 0x00007f68dcabc3c4\n2  libpthread.so.0 
0x00007f68db9c1340\n3  libpthread.so.0  0x00007f68dd6e94d1\nStack dump:\n0.
Program arguments: lli tests/tmp/pos_string_cut3 \n./tests/integration_tests:
Zeile 204: 18442 Speicherzugriffsfehler  (Speicherabzug geschrieben) lli
"$TMPDIR/$@"\n".
MaximilianC commented 10 years ago

strcut now checks whether the index argument is negative or too large for the given string and prints appropriate error messages (integration tests added as well, the fix currently resides in the intertarget-code branch)

fc36f5a832e5d748cbbc0fe1db905fc73f5194a7