View Issue Details

IDProjectCategoryView StatusLast Update
0038161LazarusIDEpublic2020-12-12 17:14
ReporterOkobaPatino Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version2.1 (SVN) 
Summary0038161: Messages window does not show all
DescriptionI have a project that has some problems with inlining some lines. I liked to know the reason and added an issue that FPC can report the issue. As written by the developers, FPC already says the reason, but Lazarus does not show it.
program InlineHint;
 
uses unit1;
 
  function Test1(A: PChar): PChar; inline;
  begin
    Result := A + 1;
  end;
 
var
  S: String;
  P: PChar;
begin
  S := 'Test';
  P := Pointer(S); //Inlined
  P := Test1(P);
  P := Test1(Pointer(S)); //Not inlined
end.

When compiled by Lazarus, there is only a message about it can not inline the code, like the attached screenshot.
I tried to compile directly with FPC, and here is the result:
ppcx64 -l -Mobjfpc -B -Sh -vhd InlineHint.lpr


Found source file name "InlineHint.lpr"
Free Pascal Compiler version 3.3.1-r47323 [2020/11/05] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Compiler OS: Win64 for x64
Target OS: Win64 for x64
Compiling InlineHint.lpr
Compiling Unit1.pas
Unit1.pas(3,2) Handling switch "$MODE"
Unit1.pas(3,16) Handling switch "$H+"
Unit1.pas(13,1) procedure/function Test2(const PChar):^Char;
Unit1.pas(14,13) Note: Call to subroutine "function Test1(const A:PChar):^Char;" marked as inline is not inlined
Unit1.pas(18,1) procedure/function Test1(const PChar):^Char;
InlineHint.lpr(6,3) procedure/function Test1(PChar):^Char;
InlineHint.lpr(17,8) Not inlining "Test1", invocation parameter contains an unsafe/unsupported construct
InlineHint.lpr(17,8) Note: Call to subroutine "function Test1(A:PChar):^Char;" marked as inline is not inlined
InlineHint.lpr(3,6) Hint: Unit "Unit1" not used in InlineHint

As you can see, there are two messages, including the reason for not inlining for (17,8), and Lazarus only shows one. Maybe because the second one is not "Note: " or because there are two for one line, or perhaps I missed an option.

Can anyone check this and let me know if I am missing something or it is an issue?
Steps To ReproduceRun the attached project with the latest Lazarus.
Additional InformationCheck the related issue for FPC.
Forum discussion: https://forum.lazarus.freepascal.org/index.php?topic=52379.new;topicseen#new
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Relationships

related to 0038113 resolvedJonas Maebe FPC Reason for not inlining 

Activities

OkobaPatino

2020-12-03 07:51

reporter  

InlineHint.zip (1,765 bytes)
Screenshot.png (14,023 bytes)   
Screenshot.png (14,023 bytes)   

OkobaPatino

2020-12-03 07:52

reporter   ~0127328

Last edited: 2020-12-03 11:44

View 2 revisions

Please, someone with the proper access, relate this issue to 0038113

Bart Broersma

2020-12-03 09:20

developer   ~0127331

Q1: does Lazarus use the same compiler as the one you invoke from commandline?
Q2: did you supplly the same parameters to the compiler in Compiler Options as you did on commandline?
Q3: what are your settings for filtering of the messages?

OkobaPatino

2020-12-03 09:46

reporter   ~0127333

A1: Yes. I ran the compiler from the Lazarus folder that I pulled and compile recently.
A2: Yes, and tried even more as suggested in the other issue and forum post.
A3: Filter None. It shows almost all the messages like cmd, but only filters out he second "InlineHint.lpr(17,8) " that has the reason.

Bart Broersma

2020-12-03 21:40

developer   ~0127337

Last edited: 2020-12-03 21:48

View 2 revisions

Messages window: right click, copy all/original messages.
Is it in there?

[Edit]
Just tested this, and it is there, so the IDE is filetering it away.
I have set "Filter non urgent messages" to "Filter none, do not filter by urgency"
[/Edit]

Bart Broersma

2020-12-03 22:00

developer   ~0127338

Last edited: 2020-12-03 22:24

View 3 revisions

If you uncheck "Filter warnings without source position" then the note pops up in the messages window.
Maybe the check for a position assumes that the line MUST start with "FileName(x,y)", whereas this line starts with: "debug FileName(x,y)"

At this point I'm not sure wether this is by design or a bug.
I asked on the devel ML.

OkobaPatino

2020-12-10 15:12

reporter   ~0127508

Any update on this?

Bart Broersma

2020-12-10 16:52

developer   ~0127509

Not yet, alas.

Juha Manninen

2020-12-12 09:10

developer   ~0127551

The answer from Mattias is worth copying here:
---
FPC usually has the format
 filename(line,col) MsgType: Text
Not
 MsgType: filename(line,col) Text
If -vd introduces a new format, then the scanner must be improved.
---
A patch to fix this is welcome.

Bart Broersma

2020-12-12 17:14

developer   ~0127566

I was unable to find where exactly this was scanned, everywhere I searched I ended up in abstract methods.

Issue History

Date Modified Username Field Change
2020-12-03 07:51 OkobaPatino New Issue
2020-12-03 07:51 OkobaPatino File Added: InlineHint.zip
2020-12-03 07:51 OkobaPatino File Added: Screenshot.png
2020-12-03 07:52 OkobaPatino Note Added: 0127328
2020-12-03 09:20 Bart Broersma Note Added: 0127331
2020-12-03 09:46 OkobaPatino Note Added: 0127333
2020-12-03 11:44 Bart Broersma Note Edited: 0127328 View Revisions
2020-12-03 11:44 Bart Broersma Relationship added related to 0038113
2020-12-03 21:40 Bart Broersma Note Added: 0127337
2020-12-03 21:48 Bart Broersma Note Edited: 0127337 View Revisions
2020-12-03 22:00 Bart Broersma Note Added: 0127338
2020-12-03 22:03 Bart Broersma Note Edited: 0127338 View Revisions
2020-12-03 22:24 Bart Broersma Note Edited: 0127338 View Revisions
2020-12-03 22:25 Bart Broersma Status new => confirmed
2020-12-03 22:25 Bart Broersma LazTarget => -
2020-12-10 15:12 OkobaPatino Note Added: 0127508
2020-12-10 16:52 Bart Broersma Note Added: 0127509
2020-12-12 09:10 Juha Manninen Note Added: 0127551
2020-12-12 17:14 Bart Broersma Note Added: 0127566