View Issue Details

IDProjectCategoryView StatusLast Update
0037621FPCCompilerpublic2020-11-16 22:47
ReporterCudaText man_ Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
OSLinux x64 
Product Version3.3.1 
Summary0037621: Error: Operation "+" not supported for types "PWideChar" and "PWideChar"
Descriptionatsynedit_regexpr.pas(4759,18) Error: Operation "+" not supported for types "PWideChar" and "PWideChar"

for code:
if not MatchOneCharCategory(scan + REOpSz + RENextOffSz, reginput) then Exit;
     
I have only 1 PWideChar (scan) and others 2 (+ REOpSz + RENextOffSz) are offsets (Int/Int64).
Full repo https://github.com/alexey-t/atsynedit
FPC 3.2.1 didn't give this error.

Steps To ReproduceCompile demo https://github.com/Alexey-T/ATSynEdit/tree/master/app/demo_editor
TagsNo tags attached.
Fixed in Revision47437
FPCOldBugId
FPCTarget-
Attached Files

Activities

Sven Barth

2020-08-22 17:38

manager   ~0125081

The attached example allows to reproduce this issue in a simpler way. It seems to be related to inlining.
twctest.pp (927 bytes)   
program twctest;

{$mode delphi}
{$define InlineFuncs}

type
  REChar = WideChar;
  TRENextOff = PtrInt;
  PRegExprChar = PWideChar;
  TREOp = REChar; // internal p-code type //###0.933

const
  REOpSz = SizeOf(TREOp) div SizeOf(REChar);
  RENextOffSz = (SizeOf(TRENextOff) div SizeOf(REChar));

function CheckCharCategory(AChar: REChar; Ch0, Ch1: REChar): boolean;
// AChar: check this char against opcode
// Ch0, Ch1: opcode operands after OP_*CATEGORY
begin
end;

function MatchOneCharCategory(opnd, scan: PRegExprChar): boolean; {$IFDEF InlineFuncs}inline;{$ENDIF}
// opnd: points to opcode operands after OP_*CATEGORY
// scan: points into InputString
begin
  Result := CheckCharCategory(scan^, opnd^, (opnd + 1)^);
end;

procedure Test;
var
  scan, reginput: PRegExprChar;
begin
  if not MatchOneCharCategory(scan + REOpSz + RENextOffSz, reginput) then Exit;
end;

begin
  Test;
end.
twctest.pp (927 bytes)   

Issue History

Date Modified Username Field Change
2020-08-22 17:17 CudaText man_ New Issue
2020-08-22 17:38 Sven Barth Note Added: 0125081
2020-08-22 17:38 Sven Barth File Added: twctest.pp
2020-11-16 22:47 Florian Assigned To => Florian
2020-11-16 22:47 Florian Status new => resolved
2020-11-16 22:47 Florian Resolution open => fixed
2020-11-16 22:47 Florian Fixed in Revision => 47437
2020-11-16 22:47 Florian FPCTarget => -