Compiler crash when assigning CP_UTF7 string and compiling with -FcUTF8
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
The following program crashes the compiler, if compiled with -FcUTF8
program cps;
{$mode objfpc}
{$h+}
type
Utf7String = type AnsiString(CP_UTF7);
var
U7: Utf7String;
begin
U7 := 'U7'; //cps.lpr(13,9) Error: Unknown codepage "65000"
end.
Steps to reproduce:
C:\Users\Bart\LazarusProjecten\bugs\Console\cpstring>fpc cps.lpr
Free Pascal Compiler version 3.3.1 [2019/05/12] for i386
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling cps.lpr
cps.lpr(13,9) Error: Unknown codepage "65000"
cps.lpr(65) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: C:\pp\bin\i386-win32\ppc386.exe returned an error exitcode
Now add -FcUTF8
C:\Users\Bart\LazarusProjecten\bugs\Console\cpstring>fpc -FcUTF8 cps.lpr
Free Pascal Compiler version 3.3.1 [2019/05/12] for i386
Copyright (c) 1993-2018 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling cps.lpr
cps.lpr(13,9) Error: Unknown codepage "65000"
cps.lpr(13,9) Error: Compilation raised exception internally
Fatal: Compilation aborted
An unhandled exception occurred at $00477B14:
EAccessViolation: Access violation<br/>
$00477B14 GETASCII, line 697 of C:/devel/fpc/trunk/rtl/inc/charset.pp
$004C3954 TTYPECONVNODE__SIMPLIFY, line 2926 of ncnv.pas
$004C27F9 TTYPECONVNODE__PASS_TYPECHECK, line 2426 of ncnv.pas
$004CC597 TYPECHECKPASS_INTERNAL, line 81 of pass_1.pas
$004BD2E7 INSERTTYPECONV, line 380 of ncnv.pas
$004CC597 TYPECHECKPASS_INTERNAL, line 81 of pass_1.pas
$00552EFB STATEMENT_BLOCK, line 1367 of pstatmnt.pas
$00538079 BLOCK, line 381 of psub.pas
$00439919 COMPILE, line 395 of parser.pas
$00416674 COMPILE, line 278 of compiler.pas
Additional information:
See related discussion in https://forum.lazarus.freepascal.org/index.php/topic,45380.msg320902.html#msg320902
While trying to use CP_UTF7 may be bonkers in the first place, the compiler should not crash.
I was unable to make it crash specifying another codepage with -Fc
Fpc 3.0.4 also crashes on that line (with -FcUTF8)
Mantis conversion info:
- Mantis ID: 35581
- OS: Windows
- OS Build: 10
- Build: r42051
- Platform: i386
- Version: 3.3.1
- Fixed in version: 3.3.1
- Fixed in revision: 43764 (#4de6b3e6)
- Monitored by: » Cyrax (Cyrax)