https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124265
Bug ID: 124265
Summary: Dimension_System broken for subtypes and components
with ranges
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: liam at liampwll dot com
CC: dkm at gcc dot gnu.org
Target Milestone: ---
Created attachment 63789
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=63789&action=edit
patch
Dimension_System simply does not work properly at all for subtypes and
components with ranges. A complete patch on 15 is attached, as that's we use
for building our software, but there's been no changes to sem_dim.adb on master
that will interfere with this patch.
We use this feature in our codebase as part of out configuration system. Ranges
are used on record components to specify allowable values for the web UI. I can
point out exactly where if required.
Referring to the testcase in the attached patch the following bogus compiler
errors may be observed:
dimensions3.adb:31:07: error: dimensions mismatch in component declaration
dimensions3.adb:31:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:32:07: error: dimensions mismatch in component declaration
dimensions3.adb:32:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:33:07: error: dimensions mismatch in component declaration
dimensions3.adb:33:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:35:07: error: dimensions mismatch in component declaration
dimensions3.adb:35:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:39:07: error: dimensions mismatch in component declaration
dimensions3.adb:39:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:42:07: error: dimensions mismatch in component declaration
dimensions3.adb:42:68: error: expected dimension [], found [Length.Time**(-1)]
dimensions3.adb:45:07: error: dimensions mismatch in component declaration
dimensions3.adb:45:63: error: expected dimension [], found [Length]
dimensions3.adb:67:24: error: both operands for operation "=" must have same
dimensions
dimensions3.adb:67:24: error: left operand is dimensionless
dimensions3.adb:67:24: error: right operand has dimension [Length.Time**(-1)]