View Issue Details

IDProjectCategoryView StatusLast Update
0011303FPCCompilerpublic2008-08-21 23:42
ReporterIlya LyubinskiyAssigned ToFlorian 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version2.2.0Product Build 
Target VersionFixed in Version 
Summary0011303: Some warning are not issued
DescriptionThe code bellow should produce a warning like this "the variable i is assigned a value which is never used". However, the compiler does not generate any warnigns. While this is not critical, I would feel much more comfortable if I was sure that the compiler issues a warning if I write a code which potentially has a mistake.

{$hints on}
{$notes on}
{$warnings on}

program test;

function f: Longint;
var i: Longint;
begin
  i := 1;
  i := 2;
  f := i;
end;

begin
  f
end.
Tagsdfa
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Ilya Lyubinskiy

2008-05-15 23:20

reporter   ~0019427

Another sample of the code that does not issue correct warnings. This code should issue a warning like this "the result of the function might be un-initialized". Obviously, the code like the one bellow has big chance to contain error. And it would be really helpful if compiler issued a warning in such situations.


{$hints on}
{$notes on}
{$warnings on}

program test;

var k: Longint = 1;

function f: Longint;
begin
  if k = 1 then f := 2;
end;

begin
  f
end.

Jonas Maebe

2008-05-15 23:51

manager   ~0019430

The example in your comment is a duplicate of 0008079. And please create separate reports for separate issues (whether or not they are related is irrelevant), because otherwise it can become very hard to close a bug report (and to assign it to someone, and to follow it up, and ...).

Issue History

Date Modified Username Field Change
2008-05-15 23:16 Ilya Lyubinskiy New Issue
2008-05-15 23:20 Ilya Lyubinskiy Note Added: 0019427
2008-05-15 23:51 Jonas Maebe Note Added: 0019430
2008-08-17 15:29 Jonas Maebe Tag Attached: dfa
2008-08-21 23:42 Florian Status new => assigned
2008-08-21 23:42 Florian Assigned To => Florian