Skip to content
GitLab
Next
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • FPC Source FPC Source
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
    • Locked files
  • Issues 1,403
    • Issues 1,403
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 67
    • Merge requests 67
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test cases
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • FPC
  • FPCFPC
  • FPC SourceFPC Source
  • Issues
  • #38698
Closed
Open
Issue created Apr 03, 2021 by FPC Admin account@fpc_adminOwner

Deadstore optimisation can break a for-loop

Original Reporter info from Mantis: bunnylin @bunnylin
  • Reporter name: Kirinn

Description:

Run this tiny program to reproduce. When compiled without deadstore optimisation, it runs as expected; i = 1 in the for-loop.

When compiled with -gt -Oodfa,deadstore then i has a trash value within the for-loop, which shouldn't be possible.

Interestingly, this only happens if i is an unsigned type. Any signed type still works correctly.

Steps to reproduce:

procedure ForLoop;
var i : dword;
begin
	for i := 1 to 1 do begin
		writeln('i=',i);
		if i <> 1 then halt(1);
	end;
end;

begin
ForLoop;
end.
------------------
Compile with:
fpc -gt -Oodfa,deadstore

Mantis conversion info:

  • Mantis ID: 38698
  • OS: Windows/Linux
  • Platform: x86_64
  • Version: 3.2.0
  • Fixed in version: 3.3.1
  • Monitored by: » @MageSlayer (Denis Golovan)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking