🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #6012

Re: gcc 2.7.2 problem with strtok()

#6012
From: Kaz Kylheku
Date: Tue, 31 Dec 1996 00:00
26 lines
1414 bytes
In article <59vbmi$9i0@nntpb.cb.lucent.com>, M.Wang <xiaofei@lucent.com> wrote:
>what is wrong with the following program?

This is a forum for reporting GCC bugs, not a C programming help forum. I
think you want comp.lang.c or gnu.gcc.help.

>#include <stdio.h>
>#include <string.h>
>
>int
>main()
>{
>strtok("a b c", " ");
>return 0;
>}

This is not a valid ANSI C program, because attempting to modify string
literals is prohibited and invokes undefined behavior. Many UNIX
implementations of the C language take advantage of this constraint and
place string literals in memory pages that are marked as read-only
(for example, string literals may be interspersed throughout the code
section of the executable).

You have not exposed a GCC bug.  A compiler bug is exposed when a *correct*
program fails to translate and execute properly. 
Technical Details
Message-ID: <5abp05$a3s$1@aphex.direct.ca>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <59vbmi$9i0@nntpb.cb.lucent.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 113d02,18b9f2c0ce00f3
X-Google-Attributes: gid113d02,public
From: kaz@bullwinkle.ai.mit.edu (Kaz Kylheku)
Subject: Re: gcc 2.7.2 problem with strtok()
Date: 1996/12/31
Message-ID: <5abp05$a3s$1@aphex.direct.ca>
X-Deja-AN: 206989282
sender: bug-gcc-request@prep.ai.mit.edu
references: <59vbmi$9i0@nntpb.cb.lucent.com>
organization: I need to put my ORGANIZATION here.
x-gateway: relay5.UU.NET from bug-gcc to gnu.gcc.bug; Tue, 31 Dec 1996 14:22:50 EST
newsgroups: gnu.gcc.bug