Defect Report #020
Submission Date: 10 Dec 92
Submittor: WG14
Source: X3J11/91-006 (Bruce Lambert)
Question 1
Is a compiler which allows the Relaxed Ref/Def linkage model to be considered
a conforming compiler? That is, can a compiler that compiles the following
code with no errors or warnings
filea.c:
#include stdio.h>
void foo(void);
int age;
int main()
{
age = 24;
printf("my age is %d.\n", age);
foo();
printf("my age is %d.\n", age);
return 0;
}
fileb.c:
#include <stdio.h>
int age;
void foo()
{
age = 25;
printf("your age is %d.\n", age);
}
and which produces the following output
my age is 24
your age is 25
my age is 25
be called a standard-compliant compiler?
Response
Yes, a compiler that allows the Relaxed Ref/Def model can be standard conforming.
(In this case, the model permits two tentative definitions for age
in two translation units to resolve to a single definition at link time.)
See subclause 6.7, page 81, lines 23-25. The code is conforming but not
strictly conforming. The behavior is undefined.
Previous Defect Report
< - >
Next Defect Report