AdaCore / AdaCore/gnatformat

Crash (INTERNAL_ERROR_OFF_ON_INVALID_MARKER) on file generated by gnattest

Open
#8 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Ada
Stars
21
Forks
2
PR merge metrics
No merged PRs in 30d

Description

To reproduce

$ cat >dut.ads
package DUT is
   procedure Dummy
   with Test_Case => ("Test_Dummy", Nominal);
end DUT;
$ cat >dut.gpr 
project DUT is
   for Source_Dirs use ("./");
end DUT;

And then:

$ gnattest -P dut.gpr
$ gnatformat -P dut.gpr --verbose gnattest/tests/dut-test_data-tests.adb
[GNATFORMAT] GNATformat 26.0.0 976b276ba6
[GNATFORMAT] Elaborating GPR2
[GNATFORMAT] Resolving project file
[GNATFORMAT] Using the default unparsing configuration
[GNATFORMAT] Successfully loaded project "dut.gpr"
[GNATFORMAT] Getting command line sources
[GNATFORMAT] Resolving gnattest/tests/dut-test_data-tests.adb
[GNATFORMAT] Project does not have a Format package
[GNATFORMAT] Processing project source dut-test_data-tests.adb
Failed to format gnattest/tests/dut-test_data-tests.adb
Original source does not contain the same amount of markers as the formatted source
[GNATFORMAT] raised GNATFORMAT.FORMATTING.INTERNAL_ERROR_OFF_ON_INVALID_MARKER : Original source does not contain the same amount of markers as the formatted source
_GNATFORMAT_ Load address: 0x564469dca000
_GNATFORMAT_ Call stack traceback locations:
_GNATFORMAT_ 0x56446a7ba9a2 0x56446a7bad4a 0x56446a7bae5c 0x56446a7471c0 0x56446a749b28 0x56446a6a09c6 0x56446a69990c 0x7f42f3d61ca6 0x7f42f3d61d63 0x56446a69f54f 0xfffffffffffffffe
[GNATFORMAT] Load address: 0x564469dca000
_GNATFORMAT_ [/home/jq/.alire/bin/gnatformat]
_GNATFORMAT_ 0x56446a7ba9a2 Gnatformat.Formatting.Restore_Off_On_Sections at gnatformat-formatting.adb:509
_GNATFORMAT_ 0x56446a7bad4a Gnatformat.Formatting.Format.Localalias at gnatformat-formatting.adb:606
_GNATFORMAT_ 0x56446a7bae5c Gnatformat.Formatting.Format.2.Localalias at gnatformat-formatting.adb:42
_GNATFORMAT_ 0x56446a7471c0 Gnatformat.Full_Format.Full_Format.Process_Project_Source at gnatformat-full_format.adb:186
_GNATFORMAT_ 0x56446a749b28 Gnatformat.Full_Format.Full_Format at gnatformat-full_format.adb:461
_GNATFORMAT_ 0x56446a6a09c6 Gnatformat.Ada_Driver at gnatformat-ada_driver.adb:197
_GNATFORMAT_ 0x56446a69990c Main at b__gnatformat-ada_driver.adb:4168
_GNATFORMAT_ [/lib/x86_64-linux-gnu/libc.so.6]
_GNATFORMAT_ 0x7f42f3d61ca6
_GNATFORMAT_ 0x7f42f3d61d63
_GNATFORMAT_ [/home/jq/.alire/bin/gnatformat]
_GNATFORMAT_ 0x56446a69f54f _start at ???
_GNATFORMAT_ 0xfffffffffffffffe
This error was an internal bug, please consider reporting it with the --verbose traces

Versions

gnatformat from Alire:

$ gnatformat --version
GNATformat 26.0.0 (976b276ba6)

gnattest from Alire

$ gnattest --version
GNATTEST Pro dev
Copyright (C) 2004-unknown, AdaCore.
This is free software; see the source for copying conditions.
See your AdaCore support agreement for details of warranty and support.
If you do not have a current support agreement, then there is absolutely
no warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce with the DUT project and generated gnattest/tests/dut-test_data-tests.adb, then inspect Restore_Off_On_Sections in gnatformat-formatting.adb at line 509 and the caller in gnatformat-full_format.adb at line 186. Done means gnatformat processes this generated source without the marker-count failure or INTERNAL_ERROR_OFF_ON_INVALID_MARKER crash.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.