A link error would be the expected outcome, but not the compiler access violation on the compile of test2.c
$ cc /version
VSI C X7.4-726 (GEM 50X23) on OpenVMS x86_64 E9.2-1
test1.c
Code: Select all
#include <stdlib.h>
#include <stdio.h>
extern char *add_article(const char *a, const char *t, char *b, size_t s);
extern char *Add_article(const char *a, const char *t, char *b, size_t s);
char my_text[80];
const char *my_article = "the",
*phrase = "rain in spain stays mainly on the plain.";
int main(int argc, char *argv[])
{
printf("%s\n",
Add_article(my_article, phrase, my_text, sizeof my_text));
printf("Repeat, %s\n",
add_article(my_article, phrase, my_text, sizeof my_text));
return EXIT_SUCCESS;
}
Code: Select all
#include <stdlib.h>
#include <stdio.h>
char *add_article(const char *article, const char *txt, char *bf, size_t bsize)
{
(void) snprintf(bf, bsize, "%s %s", article, txt);
return bf;
}
char *Add_article(const char *article, const char *txt, char *bf, size_t bsize)
{
char *r = add_article(article, txt, bf, bsize);
if (r && *r >= 'a' && *r <= 'z')
*r &= ~0x20;
return r;
}
$! successful compile
$ cc test2.c
$! Here is the compiler crash if test2.c is compiled as on line above, without /names=(as_is).
Code: Select all
%SYSTEM-F-ACCVIO, access violation, reason mask=04, virtual address=000000000000
0028, PC=0000000001130721, PS=0000001B
%TRACE-F-TRACEBACK, symbolic stack dump follows
image module routine line rel PC abs PC
DECC$COMPILER 0 0000000001130721 0000000001130721
DECC$COMPILER 0 0000000001096D15 0000000001096D15
DECC$COMPILER [.src]g2l_symbol.cxx InsertAtEnd
#948 0000000000A508DF 0000000000A508DF
DECC$COMPILER [.src]g2l_symbol.cxx convertSymbol
#706 0000000000A4F1F5 0000000000A4F1F5
DECC$COMPILER [.src]g2l_module.cxx convertDeclarations
#1487 0000000000A4D348 0000000000A4D348
DECC$COMPILER [.src]g2l_module.cxx convertDeclarations
#1502 0000000000A4D440 0000000000A4D440
DECC$COMPILER [.src]g2l_module.cxx convertModule
#1123 0000000000A4A588 0000000000A4A588
DECC$COMPILER [.src]g2l_module.cxx G2L_COMPILE_MODULE
#593 0000000000A49181 0000000000A49181
DECC$COMPILER GEM_VER_AREA:<SRC>GEM_CO.BLI;1 GEM_CO_COMPILE_MODULE
#3413 00000000006E2627 00000000006E2627
DECC$COMPILER COMPILE.C;1 gemc_be_master
#103705 00000000004236FE 00000000004236FE
DECC$COMPILER COMPILE.C;1 gem_xx_compile
#102916 00000000004223D7 00000000004223D7
DECC$COMPILER GEM_VER_AREA:<SRC>GEM_CP_VMS.BLI;1 GEM_CP_MAIN
#2643 00000000006D4C1E 00000000006D4C1E
DECC$COMPILER 0 0000000000AD76D4 0000000000AD76D4
DECC$COMPILER 0 00000000020F6D6D 00000000020F6D6D
PTHREAD$RTL 0 000000008004122C FFFF830008D0322C
PTHREAD$RTL 0 0000000080002316 FFFF830008CC4316
0 FFFF8300071FBDC6 FFFF8300071FBDC6
DCL 0 000000008006741B 000000007ADFF41B
%TRACE-I-LINENUMBER, Leading '#' specifies a source file record number.
%TRACE-I-END, end of TRACE stack dump