Welcome Guest ( Log In | Register )

Reply to this topicStart new topic
> -fwritable-strings bug, -fwritable-strings bug
post Feb 17 2005, 03:08 PM
Post #1


Group: Members
Posts: 2
Joined: 17-February 05
Member No.: 551

We are encountering a bug with the insure compiler that didn't use to happen in previous versions(eg. v6).
The insure compiled program is ignoring the -fwritable-strings option and crashes during runtime.
We are using the linux build from 2005-01-31 of insure++ v7.0. There actually seems to be a number of problems with v7.0, for example, the linker is pulling in many more libraries than the regular linker would normally(this didn't happen in v6.0 either). But the -fwritable-strings option is the biggest problem for me right now. I know that changing a constant string is a great sin, but it is not something we can easily change in our code base.

To reproduce use this test case:

#include <stdio.h>

char *constStr = "constant string test\n";

printf("%s", constStr);

constStr[0] = 'x';
constStr[1] = 'x';
constStr[2] = 'x';

printf("%s", constStr);


# This is normal and works ok
cc -w -fwritable-strings -ggdb -Werror -c -o insure_test.o insure_test.c
g++ insure_test.o -o insure_test

# this is with insure and fails.
insure -w -fwritable-strings -ggdb -Werror -c -o insure_test.o insure_test.c
insure insure_test.o -lpthread -o insure_test
Go to the top of the page
+Quote Post
post Feb 18 2005, 11:05 AM
Post #2


Group: Staff
Posts: 152
Joined: 25-November 03
Member No.: 60

This is something that has actually been fixed but the fix is not part of the currently shipping version of insure. However you can go into the

<insure installation directory>lib.linux2/{gcc,g++}

directories and edit the


files you'll see there.

In the

proc CompilerInit0 {args}

routine just add

addPattern {-fwritable-strings} {
addEdgMpfArg --no_const_string_literals
addCcArg -fwritable-strings
addPattern {-fno-for-scope} {
addEdgMpfArg --old_for_init
addCcArg -fno-for-scope

and it should take care of this.
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:


RSS Lo-Fi Version Time is now: 13th October 2015 - 07:58 PM