mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cameron Simpson <cs@zip.com.au>
To: Tom Rini <trini@kernel.crashing.org>
Cc: Momchil Velikov <velco@fadata.bg>,
	linux-kernel@vger.kernel.org, gcc@gcc.gnu.org,
	linuxppc-dev@lists.linuxppc.org,
	Franz Sirl <Franz.Sirl-kernel@lauterbach.com>,
	Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Corey Minyard <minyard@acm.org>
Subject: Re: C undefined behavior fix
Date: Thu, 3 Jan 2002 15:08:43 +1100	[thread overview]
Message-ID: <20020103150843.B644@zapff.research.canon.com.au> (raw)
In-Reply-To: <87g05py8qq.fsf@fadata.bg> <20020102190910.GG1803@cpe-24-221-152-185.az.sprintbbd.net>
In-Reply-To: <20020102190910.GG1803@cpe-24-221-152-185.az.sprintbbd.net>; from trini@kernel.crashing.org on Wed, Jan 02, 2002 at 12:09:10PM -0700

On Wed, Jan 02, 2002 at 12:09:10PM -0700, Tom Rini <trini@kernel.crashing.org> wrote:
| On Wed, Jan 02, 2002 at 01:03:25AM +0200, Momchil Velikov wrote:
| > The GCC tries to replace the strcpy from a constant string source with
| > a memcpy, since the length is know at compile time.
| 
| Okay, here's a summary of all of the options we have:
| 1) Change this particular strcpy to a memcpy
| 2) Add -ffreestanding to the CFLAGS of arch/ppc/kernel/prom.o (If this
| optimization comes back on with this flag later on, it would be a
| compiler bug, yes?)
| 3) Modify the RELOC() marco in such a way that GCC won't attempt to
| optimize anything which touches it [1]. (Franz, again by Jakub)
| 4) Introduce a function to do the calculations [2]. (Corey Minyard)
| 5) 'Properly' set things up so that we don't need the RELOC() macros
| (-mrelocatable or so?), and forget this mess altogether.

Dudes, maybe I'm missing something here, but why don't you just mark the
source data as volatile? Then it _can't_ assume it knows the length of
the strcpy because it can't assume it knows the content:

If PTRRELOC cast the pointer type to

	volatile void *

or something else suitable generic but volatile then this discussion might
not be happening. It would at least move the optimisation into "definite
compiler bug" if it still happens.
-- 
Cameron Simpson, DoD#743        cs@zip.com.au    http://www.zip.com.au/~cs/

I think... Therefore I ride.  I ride... Therefore I am.
	- Mark Pope <erectus@yarrow.wt.uwa.edu.au>

  parent reply	other threads:[~2002-01-03  4:13 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-01 23:03 [PATCH] " Momchil Velikov
2002-01-01 23:43 ` Tom Rini
2002-01-02  6:54   ` Momchil Velikov
2002-01-02 15:39     ` Tom Rini
2002-01-02 15:50       ` Jakub Jelinek
2002-01-02 16:45         ` Paul Koning
2002-01-02 14:56   ` Joseph S. Myers
2002-01-02 22:56   ` Paul Mackerras
2002-01-02 23:37     ` Momchil Velikov
2002-01-03  2:51     ` Paul Mackerras
2002-01-03  6:29       ` law
2002-01-03 13:16         ` Lars Brinkhoff
2002-01-04  9:05     ` Florian Weimer
2002-01-04 22:14     ` Paul Mackerras
2002-01-02 10:29 ` Florian Weimer
2002-01-02 10:41   ` Momchil Velikov
2002-01-02 13:11     ` Jakub Jelinek
2002-01-02 15:54       ` Tom Rini
2002-01-02 11:28 ` Aaron Lehmann
2002-01-02 11:40   ` Momchil Velikov
2002-01-02 15:59     ` Tom Rini
2002-01-02 11:48   ` Alan Cox
2002-01-02 19:09 ` Tom Rini
2002-01-02 20:13   ` Joe Buck
2002-01-02 20:42     ` Tom Rini
2002-01-02 21:36   ` Richard Henderson
2002-01-02 22:05     ` Tom Rini
2002-01-02 22:23       ` jtv
2002-01-02 23:12         ` Tom Rini
2002-01-02 23:45           ` jtv
2002-01-03  0:01             ` Tom Rini
2002-01-03  0:07               ` Richard Henderson
2002-01-03  0:16                 ` Tom Rini
2002-01-03  1:12                   ` Richard Henderson
2002-01-03  0:20                 ` jtv
2002-01-03  0:25               ` Alan Cox
2002-01-03  0:35                 ` David Woodhouse
2002-01-03  2:10                   ` Tom Rini
2002-01-03 22:39                     ` Pavel Machek
2002-01-04  9:29                     ` Paul Mackerras
2002-01-03 15:46                   ` Edgar Toernig
2002-01-03 16:48                     ` Momchil Velikov
2002-01-03 17:13                     ` jtv
2002-01-03 21:26                   ` Daniel Jacobowitz
2002-01-03  2:33               ` Paul Mackerras
2002-01-03  8:32                 ` Richard Henderson
2002-01-03 10:03                 ` Geert Uytterhoeven
2002-01-03 10:10                 ` Paul Mackerras
2002-01-03 22:41                   ` Tim Hollebeek
2002-01-04  8:48                   ` Florian Weimer
2002-01-02 22:27       ` Richard Henderson
2002-01-02 22:35         ` Tom Rini
2002-01-02 22:44           ` Richard Henderson
2002-01-02 22:50             ` Tom Rini
2002-01-03 22:40         ` Pavel Machek
2002-01-04  8:42           ` Richard Henderson
2002-01-03  4:08   ` Cameron Simpson [this message]
2002-01-03  4:32     ` Tom Rini
2002-01-04  8:42   ` [PATCH] " Florian Weimer
2002-01-02 23:11 ` Paul Mackerras
2002-01-02 23:26   ` Tom Rini
2002-01-02 23:28   ` Momchil Velikov
2002-01-02 23:34     ` Tom Rini
2002-01-03  0:19       ` jtv
2002-01-03  0:29         ` Tom Rini
2002-01-03  1:03           ` jtv
2002-01-03  1:17             ` Tom Rini
2002-01-03 17:44               ` jtv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020103150843.B644@zapff.research.canon.com.au \
    --to=cs@zip.com.au \
    --cc=Franz.Sirl-kernel@lauterbach.com \
    --cc=benh@kernel.crashing.org \
    --cc=gcc@gcc.gnu.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=minyard@acm.org \
    --cc=paulus@samba.org \
    --cc=trini@kernel.crashing.org \
    --cc=velco@fadata.bg \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®