This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

c/5033: non const char *'s initial pointee data left on read only segment, causes seg. fault.



>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:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]