View Issue Details

IDProjectCategoryView StatusLast Update
0035450FPCPackagespublic2020-02-28 10:29
ReporterCudaText man Assigned ToPierre Muller  
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version3.3.1 
Summary0035450: RegExpr test app, cross compiled to Solaris x64, fails
DescriptionHost: Linux x64, fpcupdeluxe 1.6.2u (today version), FPC cross lib installed for Solaris x64
Attached demo.
Make this demo for Solaris, and run on Solaris (with Gnome shell).

On Win/Linux, demo shows ok result: "ok match"
On Solaris, demo shows "no match", ie RegExpr unit (from FPC) cannot find string by regex
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

CudaText man

2019-04-26 14:15

reporter  

Pierre Muller

2019-04-26 17:18

developer   ~0115826

  Hi,

  please try to submit code that can be compiled with a simpe FPC installation
when your bug report is about Free Pascal compiler or packages.

  I simplified your code to test it, and cross-compiled it from
linux to sparc-solaris without getting a different behavior.
  Please try new attached test source code and let us know if you get the same
issue for this simplified code.

Pierre Muller

Pierre Muller

2019-04-26 17:19

developer   ~0115827

New simplified test code
test-regex.pp (1,563 bytes)   
uses
  Classes, SysUtils,   regexpr;

type
  TRegexParts = array[0..8] of
    record
      Pos, Len: integer;
      Str: string;
    end;

function SRegexFindParts(const ARegex, AStr: string; out AParts: TRegexParts): string;
var
  Obj: TRegExpr;
  i: integer;
begin
  Result:= '';
  for i:= Low(AParts) to High(AParts) do
  begin
    AParts[i].Pos:= -1;
    AParts[i].Len:= 0;
    AParts[i].Str:= '';
  end;

  if ARegex='' then exit;
  if AStr='' then exit;

  Obj:= TRegExpr.Create;
  try
    Obj.ModifierS:= false; //don't catch all text by .*
    Obj.ModifierM:= true; //allow to work with ^$
    Obj.ModifierI:= false;

    try
      Obj.Expression:= ARegex;
      Obj.InputString:= AStr;
      //Result:=
      Obj.ExecPos(1);
      if Obj.MatchPos[0]<=0 then
        Result:= 'no match';
    except
      on e: Exception do
        Result:= e.Message;
    end;

    if Result='' then
    begin
      for i:= Low(AParts) to High(AParts) do
      begin
        AParts[i].Pos:= Obj.MatchPos[i];
        AParts[i].Len:= Obj.MatchLen[i];
        AParts[i].Str:= Obj.Match[i];
      end;
    end;
  finally
    FreeAndNil(Obj);
  end;
end;

const
  cRegex_SignFunc = 'module=(.+?);func=(.+?);(info=(.+?);)?$';
var
  Parts: TRegexParts;
  Regex, Res: string;
begin
  Regex:= 'module=ttttttttttt;func=_dlg_dddddddddddddddddddd;info="dddddddddddddddd:<function DlgAgent._ddddddd.<locals>.ddddddddddddd at 0x7ffffffffffffffffff>";';

  Res:= SRegexFindParts(cRegex_SignFunc, Regex, Parts);
  if Res='' then Res:= 'ok match';
  Res:= ': '+Res;
  writeln(Res);

end.
test-regex.pp (1,563 bytes)   

Pierre Muller

2019-04-26 23:04

developer   ~0115835

  I compiled the simplified source code for x86_64-solaris
system natively, and got the same output.

  This means:
1) There is indeed a different output for x86-64 CPU (both sparc and i386 executables return ok)
2) It is not a cross-compilation issue.

Which probably means that it is a CPU specific code generation issue.

CudaText man

2020-02-28 10:29

reporter   ~0121250

Problem is still here with new TRegExpr (not from FPC trunk, but from Sorokin).

Issue History

Date Modified Username Field Change
2019-04-26 14:15 CudaText man New Issue
2019-04-26 14:15 CudaText man File Added: test_regex_match_loop.zip
2019-04-26 17:18 Pierre Muller Assigned To => Pierre Muller
2019-04-26 17:18 Pierre Muller Status new => feedback
2019-04-26 17:18 Pierre Muller Note Added: 0115826
2019-04-26 17:19 Pierre Muller File Added: test-regex.pp
2019-04-26 17:19 Pierre Muller Note Added: 0115827
2019-04-26 20:47 CudaText man Status feedback => assigned
2019-04-26 23:04 Pierre Muller Status assigned => confirmed
2019-04-26 23:04 Pierre Muller Note Added: 0115835
2020-02-28 10:29 CudaText man Note Added: 0121250