cd /news/developer-tools/fortls-bug-not-matching-statement-la… · home › topics › developer-tools › article
[ARTICLE · art-167914] src=fortran-lang.discourse.group ↗ pub= topic=developer-tools verified=true sentiment=↓ negative

Fortls bug not matching statement labels with different numbers of leading zero

Fortls, the Fortran language server, fails to treat statement labels as equivalent when they differ in leading zeros, flagging a "Unexpected end of scope" error for code where a `do 10` loop closes on `0010 continue`. The reporter, who encountered the bug while bringing legacy code into a modern project, said an AI agent inspected fortls's Python source and found it compares statement labels as text strings rather than integers, a likely cause of the mismatch.

read1 min views1 publishedNov 11, 2026

It seems fortls doesn’t recognize statement labels as equivalent when they have different numbers of leading zeros, such as 10 and 0010. It reports an error for “Unexpected end of scope…”

I encountered this when bringing some legacy code into a modern project. Here’s a minimal reproducible example:

      do 10 i=1,3
         print *, i
 0010 continue
      end

My AI agent told me it looked at the Python source code of fortls and discovered it treats statement labels as text strings rather than integers. That may be the reason for the bug.

── more in #developer-tools 4 stories · sorted by recency
── more on @fortls 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/fortls-bug-not-match…] indexed:0 read:1min 2026-11-11 · —