EGCS 1.0.2. switch in inline functions.
Alexander Favorov
favorov@sensi.org
Mon Aug 17 17:06:00 GMT 1998
Hi!
The code :
************************
#include <stdio.h>
inline
int func(char c)
{
switch (c)
{
case 'a':return 1;
case 't':return 2;
case 'g':return 3;
case 'c':return 4;
case 'n':return 5;
}
}
main()
{
printf("%i\n",func('g'));
return 0;
}
************************
being compiled _without_ optimization gives on WIN NT sush a result:
(G:\SASHA\atgc\atgcengi\a.exe 1007) Exception: STATUS_ACCESS_VIOLATION
(G:\SASHA\atgc\atgcengi\a.exe 1007) Dumping stack trace to a.exe.core
(Sometimes the exception is ILLEGAL_INSTRUCTION :)).
This effect disappers if the 'inline' directive is removed or
if -O1 (O2,O3) option is given to g++.
With best regards, Alexander.
More information about the Gcc-bugs
mailing list