This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/5033: non const char *'s initial pointee data left on read only segment, causes seg. fault.
- From: rs025019 at se dot ritsumei dot ac dot jp
- To: gcc-gnats at gcc dot gnu dot org
- Date: 6 Dec 2001 12:17:28 -0000
- Subject: c/5033: non const char *'s initial pointee data left on read only segment, causes seg. fault.
- Reply-to: rs025019 at se dot ritsumei dot ac dot jp
>Number: 5033
>Category: c
>Synopsis: non const char *'s initial pointee data left on read only segment, causes seg. fault.
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 06 04:26:03 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: rs025019@se.ritsumei.ac.jp
>Release: gcc 2.95.2
>Organization:
>Environment:
1. Debian GNU/Linux 2.2r4 (gcc 2.95.2 20000220), PentiumII
2. Cygwin (gcc 2.95.3-5 cygwin special), Pentium III
3. SunOS? (gcc 2.81?), UltraSparcII
>Description:
Like attached source, auto variable of char * p's initial pointee data is placed on code (or rodata) segment, and be operated still on the same segment, not stack or data segment, and causes segmentation fault.
This may be ok if that char * is implicitly processed as const char * (I don't know much about the standard, sorry), but even with -Wall, gcc listed at "Environment" seems not to report this (cf. lint reports this).
>How-To-Repeat:
gcc [-Wall] <attached file>
./a.out
>Fix:
non const auto pointer's pointee data placed on .text (or .rodata) should be copyed to data or stack segment, or gcc should just warn it at least when -Wall flag is on.
>Release-Note:
>Audit-Trail:
>Unformatted: