[Gllug] SIGSEGV error

t.clarke tim at seacon.co.uk
Wed Aug 29 15:43:06 UTC 2007


Just a passing thought;

you said it compiled OK on ubuntu



There is a little 'gotcha' in the Gnu C compiler  (if it is invoked directly
or indirectly) involving static strings in programs.

If a program attempts to modify a declared static string the program will fall
over with a segment violation, as the static string is linked into the 'text'
scetion of the porgram as opposed to the 'writable' variable portion of the
program.  If this is the cause of the fault,  compiling with -fwritable-strings
will cause the compiler to locate the stgatic strings in 'writable' memory,
and thus the program will not segfault though trying to write to 'text' memory.

Hope his makes some sort of sense  !!


Tim
-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list