Bug 105655 - segmentation fault on evaluating expr. --*(ptr--)
segmentation fault on evaluating expr. --*(ptr--)
Product: Red Hat Linux
Classification: Retired
Component: gcc (Show other bugs)
i686 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2003-09-26 07:46 EDT by ashish
Modified: 2007-04-18 12:57 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-09-26 08:12:38 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description ashish 2003-09-26 07:46:53 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.1) Gecko/20020830

Description of problem:
When I compiled following program and executed it gives "segmentation fault" error

char *ptr = "abcdefg";

Version-Release number of selected component (if applicable):

How reproducible:
Didn't try

Additional info:
Comment 1 Jakub Jelinek 2003-09-26 08:12:38 EDT
And you expected something else?
See ISO C99, 6.4.5 on string literals:
... "If the program attempts to modify such an array, the behavior is undefined." ...
String literals in gcc are in read-only sections if the target supports it.
You can use -fwritable-strings to make them writable (which also means non-shareable).

Note You need to log in before you can comment on or make changes to this bug.