View Issue Details

IDProjectCategoryView StatusLast Update
0035581FPCCompilerpublic2019-05-16 19:58
ReporterBart BroersmaAssigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformi386OSWindowsOS Version10
Product Version3.3.1Product Buildr42051 
Target VersionFixed in Version 
Summary0035581: Compiler crash when assigning CP_UTF7 string and compiling with -FcUTF8
DescriptionThe 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 ReproduceC:\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
  $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 InformationSee 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)
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2019-05-13 22:16 Bart Broersma New Issue