[Aldor-l] aldor.conf::gcc-hacks
Gabriel Dos Reis
gdr at integrable-solutions.net
Tue Feb 8 14:48:53 EST 2005
Hi,
The Aldor compiler, by default, passes the option -fwritable-strings
to GCC, which is unrecognized by GCC-3.4.x and later; therefore
causing the compilation to halt.
I tried to commment out that flag. However, there is a comment
in aldor.conf saying:
# On some platforms string literals are stored in read-only segments.
# This causes problems when users write Aldor programs in which a
# string literal is used as a buffer. The result is a segfault that
# is extremely hard to track down, even for experienced Aldor coders.
I'm doubly concerned: both as an aldor user and a GCC developer/maintainer.
As an aldor user, my concern is that if I remove that option -- a
necessary removal is I ever want to get my aldor programs compile --
then programs may be subject to random misbehaviour that would be hard
to track down.
As a GCC developer/maintainer, I read the coment to say that it might
be a bug in GCC. But I cannot think of any scenario where that
is the case.
If the aldor compiler generates code like
char* text = "string-constant";
and the pointer "text" is used to modify the pointed-to string, then
that is a bug in the program generated by the aldor compiler.
If the aldor compiler generates code like
char text[] = "string-constant";
then the object "text" is modifiable and GCC should not put it in
read-only sections. And if that is not the case, the it is a bug in
GCC; but all data I have suggest that GCC does not have such bug.
Since the aldor souce code is not avaliable for public inspection, I
would have some questions:
(1) which of the above code generation scenario is the case?
(2) is it really unwise to remove the -fwritable-strings option, or
it is only neecessary for some "corner" cases?
(3) is there a plan to fix that in the next version of aldor?
(no recent version of GCC will accept the option).
Thanks,
-- Gaby
More information about the Aldor-l
mailing list