Skip to content

Commit 4e66617

Browse files
committed
instrument-c.adb: avoid uninitialized record component
Make sure that the record component PP_Info.PP_Source_Range is always initialized, at least so that we do not stream absurd sloc range information to SID/checkpoint files. That went unnoticed so far because Natural'Write will happily write a negative number, and Natural'Read will happily read and assign it, without raising a Constraint_Error. This fixes no known gnatcov issue as of today, but is necessary for the upcoming work to make SID/checkpoint reading manual.
1 parent 0c455ca commit 4e66617

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/gnatcov/instrument-c.adb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,7 @@ package body Instrument.C is
735735
-- a Local_Source_Location as it can refer to #included files.
736736

737737
Info.Actual_Source_Range := (From.L, To.L);
738+
Info.PP_Source_Range := No_Local_Range;
738739

739740
-- Check if this is comes from a macro expansion, in which case we need
740741
-- to record some information, for reporting purposes.

0 commit comments

Comments
 (0)