Issue 0EMB.08: Diagnostic required on named-register constraint violation?

This issue has been automatically converted from the original issue lists and some formatting may not have been preserved.

Authors: WG14
Date: 2004-09-23
Reference document: Embedded-c email list 208, 210
Submitted against: Embedded C TR 18037:2004
Status: Fixed
Fixed in: Embedded C TR 18037:2008
Converted from: n1071.pdf, n1087.pdf, n1180.pdf

Description: consider

// file 1
register REG_A int reg_a;

// file 2
extern int reg_a;

int main() { return reg_a; }

According to the new constraints for 6.7.1 this is not allowed:

If an object is declared with a named-register storage-class specifier, every declaration of that object shall include the same named-register storage-class specifier.

The 'shall' implies that a diagnostic is required here. However, so far C compilers have not been required to diagnose such issues across translation units. Is this really the intention?

Proposed solution:


Comment from WG14 on 2004-11-15:

Problem: Consider

// file 1
register REG_A int reg_a;

// file 2
extern int reg_a;
int main() { return reg_a; }

According to the second new constraints for 6.7.1 this is not allowed:

If an object is declared with a named-register storage-class specifier, every declaration of that object shall include the same named-register storage-class specifier.

The 'shall' implies that a diagnostic is required here. However, so far C compilers have not been required to diagnose such issues across translation units. Is this really the intention?

Solution: The intent is to require a diagnostic for different named-register storage-class specifier declarations within a single translation unit for the same object.

Changes: