https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119810
Bug ID: 119810
Summary: FE: -include does not unset "included from"
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: cobol
Assignee: unassigned at gcc dot gnu.org
Reporter: simonsobisch at gnu dot org
Target Milestone: ---
Given the following COBOL source:
PROGRAM-ID. TBUG.
DATA DIVISION.
and execution of
$> echo "">empty
$> gcobol -include empty tbug.cob
yields
In file included from empty:128:
tbug.cob:3:10: error: syntax error, unexpected DATA, expecting end of file
cobol1: error: failed compiling tbug.cob
Obviously the specified source is not included in the one specified via
-include but somehow:
* there is a line of 128 ?!?
* as this line does not exist one cannot see the error in the output (drop the
-include and you see the correct position and therefore the text)
* somehow there is an include relation
* bonus bug (either fix or move out to a separate bug): that code is a valid
"program-definition" as there is no mandatory element in data-division and the
procedure-division is optional, the compiler should not error but provide an
empty function in the resulting object