This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

EGCS 1.0.2. switch in inline functions.


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.
                



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]