public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@transmeta.com>
To: mark@codesourcery.com
Cc: rth@cygnus.com, tim@wagner.Princeton.EDU, craig@jcb-sc.com,
	davem@redhat.com, chip@perlsupport.com, egcs@egcs.cygnus.com
Subject: Re: Linux and aliasing?
Date: Wed, 30 Jun 1999 15:43:00 -0000	[thread overview]
Message-ID: <Pine.LNX.3.95.990607083858.22237A-100000@penguin.transmeta.com> (raw)
Message-ID: <19990630154300.f0yUXiaF67AcrDLfZcUdSw0BwL7N9TqQt-yiqhXfNn4@z> (raw)
In-Reply-To: <19990606174538V.mitchell@codesourcery.com>

On Sun, 6 Jun 1999 mark@codesourcery.com wrote:
> 
> BTW, I've been notified in private mail that you pointed out a bug in
> GCC's real.c, involving exactly the kinds of casts were arguing about.
> (I somehow missed that message from you.)   Thanks for pointing that
> out!  I'll fix it soon.

Note that I didn't point it out as a kind of "nyaah, nyaah!" kind of
thing: it just happens that I had the gcc sources on-line and thought I'd
idly check whether it looked like it could have problems just to make
people realize how PERMEATING this is.

> I gather that you suggested your proposal would avoid changing GCC.
> But, it wouldn't, since GCC's first stage is compiled with a (possibly
> non-GCC) host compiler.  Thus, GCC *must* be written in legal ANSI/ISO
> C. 

My proposal is not just about "avoiding changing X", whether X be gcc, the
kernel, or anything else.

What I _really_ wanted to point out that even among the people who (a)
should know and (b) now quote the standard as a legal reason to do
anything, these kinds of things happen. 

My proposal is really a way of saying "ok, there is old code out there,
and we want to try to be as graceful about it as we can".

In the case of the Linux kernel, that "gracefulness" would be something I
would be really happy to take advantage of, as I don't expect to compile
the kernel with much else.

> Even in the kernel, your proposal will lead to a confusing situation.
> You claim it's DWIM, but there the "I" really is "Linus Torvalds", and
> not necessarily the rest of us.  People used to the ANSI/ISO C
> aliasing rules will have to read the GCC manual very carefully to
> figure out the meaning of your code.

No. People used to the ANSI/ISO C aliasing rules (all five of them) will
just point to the code and say it is not strictly conforming, and then
they will go back to building their ivory towers. 

It's not just the kernel. It's not just gcc. I bet there are things like
this in just about all major projects - some of which we'll never see
source code for. 

My proposal might mean that fewer people will use the "-fno-strict-alias"
switch, because they won't have to. I don't think you realize how most
professional software projects work. The "professional" part means that
people are under a deadline and don't really care about your standards
conformance, they want things to WORK. 

That may not be your definition of professional, but it's a fact of life. 

That means that I suspect that if there isn't some simple workaround (like
mine), then it's not just the kernel project that uses the disable switch.
Is that what you want?

Flexibility is a GOOD thing. Even if that flexibility means "Oh, you don't
_have_ to program to the standard, and I'll still try to do the best I
can". 

Think of it this way: you still support "-traditional -O2" - you try to
generate good code even when presented with C that isn't even called C any
more.

Why? Because the code is out there, and it's not worth changing thousands
of software packages when you can instead change one: the compiler.

> I think by now you've been presented with a variety of strategies for
> solving the problem in the kernel, including more than one idea for
> macros that you could use like:
> 
>   ALIASING_CAST (type, x)

I've been told in private email, that the proposed macro wasn't even
standards conforming in the sense that it doesn't guarantee that the
compiler couldn't decide it aliases (because in order to guarantee that
the union should contain all possible types). It happens to work for gcc. 

I don't know whether that is true - I don't have the official standard
around. But you might want to check that out.

> that would do what you want.  I believe Richard Henderson suggested
> one involving local unions; you could also use memcpy as I suggested.

Or I could use "-fno-strict-alias" which is actually preferable to
starting to introduce ugly code.

I think it was Craig who complained about maintenance. "Ugly code" is a
big maintenance issue, and it's always much much better if the "obvious"
code works even if it is not "strictly conforming". The kernel doesn't try
to be strictly conforming anyway, we use tons of other things.

> Even if we implemented your proposal you'd have to audit all your code
> to make sure that all the technically invalid casts come in
> expressions that are immediately derefenced, and not stored in
> temporaries.

Sure. But it wouldn't result in horribly ugly code.

I'm not using egcs at the moment. As such, I'm just seeing reports saying
that it's broken wrt the kernel. My reaction is still that people should
just use gcc-2.7.2, because it's just too _painful_ to upgrade to egcs.
Oh, well..

> At this point, I strongly suggest you abandon your proposal.  Nobody
> looks likely to implement it (at least on a volunteer basis),

Andy Kleen already said he was playing with patches that implemented it,
but just ignore that, like you ignore all the other arguments I've
presented. Sorry,

		Linus

  reply	other threads:[~1999-06-30 15:43 UTC|newest]

Thread overview: 218+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-06-03 10:23 Chip Salzenberg
1999-06-03 10:37 ` mark
1999-06-03 11:26   ` David S. Miller
1999-06-03 12:03     ` mark
1999-06-03 12:25       ` David S. Miller
1999-06-03 20:06         ` craig
1999-06-03 23:03           ` Linus Torvalds
1999-06-03 23:45             ` mark
1999-06-04  0:04               ` Linus Torvalds
1999-06-04  1:08                 ` Branko Cibej
1999-06-30 15:43                   ` Branko Cibej
1999-06-04  1:24                 ` Joe Buck
1999-06-04  1:50                   ` Linus Torvalds
1999-06-04  5:46                     ` craig
1999-06-04  7:22                       ` burley (was Re: Linux and aliasing?) Mark Hahn
1999-06-04  8:16                         ` craig
1999-06-30 15:43                           ` craig
1999-06-30 15:43                         ` Mark Hahn
1999-06-04  8:35                       ` Linux and aliasing? Linus Torvalds
1999-06-04 10:04                         ` Joe Buck
1999-06-04 10:22                           ` Jeffrey A Law
1999-06-04 10:31                             ` Joe Buck
1999-06-04 10:53                               ` Jeffrey A Law
1999-06-30 15:43                                 ` Jeffrey A Law
1999-06-30 15:43                               ` Joe Buck
1999-07-11 10:55                               ` Jeffrey A Law
1999-07-31 23:33                                 ` Jeffrey A Law
1999-06-04 11:11                             ` Toon Moene
1999-06-04 12:20                               ` Jeffrey A Law
1999-06-05  5:45                                 ` Toon Moene
1999-06-05  6:23                                   ` Andi Kleen
1999-06-05 10:32                                     ` Toon Moene
1999-06-05 13:26                                       ` Jamie Lokier
1999-06-05 19:35                                         ` Linus Torvalds
1999-06-06  1:18                                           ` Martin v. Loewis
1999-06-06 10:46                                             ` Linus Torvalds
1999-06-30 15:43                                               ` Linus Torvalds
1999-06-06 17:56                                             ` Jason Merrill
1999-06-06 19:24                                               ` Tim Hollebeek
1999-06-30 15:43                                                 ` Tim Hollebeek
1999-06-06 22:23                                               ` Jeffrey A Law
1999-06-30 15:43                                                 ` Jeffrey A Law
     [not found]                                               ` <199906070645.IAA00615@mira.isdn.cs.tu-berlin.de>
1999-06-07  2:14                                                 ` Jason Merrill
1999-06-07  8:02                                                   ` mark
1999-06-07  8:41                                                     ` David S. Miller
1999-06-07  9:24                                                       ` Jeffrey A Law
1999-06-07  9:29                                                         ` David S. Miller
1999-06-30 15:43                                                           ` David S. Miller
1999-06-30 15:43                                                         ` Jeffrey A Law
1999-06-07  9:32                                                       ` Joe Buck
1999-06-30 15:43                                                         ` Joe Buck
1999-06-30 15:43                                                       ` David S. Miller
1999-06-30 15:43                                                     ` mark
1999-06-07 13:11                                                   ` Jeffrey A Law
1999-06-30 15:43                                                     ` Jeffrey A Law
1999-06-30 15:43                                                   ` Jason Merrill
1999-06-30 15:43                                               ` Jason Merrill
1999-06-30 15:43                                             ` Martin v. Loewis
1999-06-30 15:43                                           ` Linus Torvalds
1999-06-30 15:43                                         ` Jamie Lokier
1999-06-05 18:48                                       ` Linus Torvalds
1999-06-30 15:43                                         ` Linus Torvalds
1999-06-30 15:43                                       ` Toon Moene
1999-06-05 10:37                                     ` mark
1999-06-05 11:09                                       ` David S. Miller
1999-06-05 12:11                                         ` Toon Moene
1999-06-05 12:21                                           ` David S. Miller
1999-06-05 16:51                                             ` mark
1999-06-30 15:43                                               ` mark
1999-06-30 15:43                                             ` David S. Miller
1999-06-30 15:43                                           ` Toon Moene
1999-06-07  6:01                                         ` Joern Rennecke
1999-06-30 15:43                                           ` Joern Rennecke
1999-06-30 15:43                                         ` David S. Miller
1999-06-05 11:35                                       ` Andi Kleen
1999-06-30 15:43                                         ` Andi Kleen
1999-06-05 12:41                                       ` Jamie Lokier
1999-06-05 14:43                                         ` Martin v. Loewis
1999-06-30 15:43                                           ` Martin v. Loewis
1999-06-05 16:53                                         ` mark
1999-06-07  2:36                                           ` Jamie Lokier
1999-06-07  8:04                                             ` mark
1999-06-30 15:43                                               ` mark
1999-06-30 15:43                                             ` Jamie Lokier
1999-06-30 15:43                                           ` mark
1999-06-30 15:43                                         ` Jamie Lokier
1999-06-30 15:43                                       ` mark
1999-06-30 15:43                                     ` Andi Kleen
1999-06-06 23:12                                   ` f77 vs type based alias analysis Jeffrey A Law
1999-06-30 15:43                                     ` Jeffrey A Law
1999-06-06 23:20                                   ` Linux and aliasing? Jeffrey A Law
1999-06-30 15:43                                     ` Jeffrey A Law
1999-06-30 15:43                                   ` Toon Moene
1999-06-30 15:43                                 ` Jeffrey A Law
1999-06-05  4:05                               ` Andi Kleen
1999-06-30 15:43                                 ` Andi Kleen
1999-06-30 15:43                               ` Toon Moene
1999-06-30 15:43                             ` Jeffrey A Law
1999-06-04 11:49                           ` Linus Torvalds
1999-06-04 13:03                             ` Gabriel Dos_Reis
1999-06-04 13:13                               ` Joe Buck
1999-06-30 15:43                                 ` Joe Buck
1999-06-30 15:43                               ` Gabriel Dos_Reis
1999-06-30 15:43                             ` Linus Torvalds
1999-06-04 12:59                           ` Alexandre Oliva
1999-06-04 13:29                             ` Joe Buck
1999-06-04 13:39                               ` Alexandre Oliva
1999-06-30 15:43                                 ` Alexandre Oliva
1999-06-30 15:43                               ` Joe Buck
1999-06-30 15:43                             ` Alexandre Oliva
1999-06-30 15:43                           ` Joe Buck
1999-06-30 15:43                         ` Linus Torvalds
1999-06-30 15:43                       ` craig
1999-06-30 15:43                     ` Linus Torvalds
1999-06-30 15:43                   ` Joe Buck
1999-06-04  5:47                 ` craig
1999-06-30 15:43                   ` craig
1999-06-04  7:11                 ` mark
1999-06-04  8:38                   ` Linus Torvalds
1999-06-30 15:43                     ` Linus Torvalds
1999-06-30 15:43                   ` mark
1999-06-04  8:41                 ` Tim Hollebeek
1999-06-04  8:53                   ` Jeffrey A Law
1999-06-30 15:43                     ` Jeffrey A Law
1999-06-30 15:43                   ` Tim Hollebeek
1999-06-30 15:43                 ` Linus Torvalds
1999-06-30 15:43               ` mark
1999-06-04  5:47             ` craig
1999-06-04  8:17               ` Linus Torvalds
1999-06-04  8:49                 ` craig
1999-06-04  8:57                   ` Linus Torvalds
1999-06-04  9:02                     ` Jean-Pierre Radley
1999-06-30 15:43                       ` Jean-Pierre Radley
1999-06-30 15:43                     ` Linus Torvalds
1999-06-30 15:43                   ` craig
1999-06-30 15:43                 ` Linus Torvalds
1999-06-30 15:43               ` craig
1999-06-04  8:39             ` Tim Hollebeek
1999-06-04  8:55               ` Linus Torvalds
1999-06-04 15:20                 ` Richard Henderson
1999-06-05  9:50                   ` Linus Torvalds
1999-06-05 11:00                     ` mark
1999-06-06 10:30                       ` Linus Torvalds
1999-06-06 10:44                         ` mark
1999-06-06 14:17                           ` Linus Torvalds
1999-06-06 17:41                             ` mark
1999-06-07  8:58                               ` Linus Torvalds [this message]
1999-06-07  9:18                                 ` mark
1999-06-07  9:29                                   ` Linus Torvalds
1999-06-07  9:38                                     ` Tim Hollebeek
1999-06-07 10:05                                       ` Jamie Lokier
1999-06-30 15:43                                         ` Jamie Lokier
1999-06-07 10:44                                       ` Linus Torvalds
1999-06-07 11:22                                         ` Jeffrey A Law
1999-06-08  1:34                                           ` Nick Ing-Simmons
1999-06-08  1:48                                             ` Jeffrey A Law
1999-06-30 15:43                                               ` Jeffrey A Law
1999-06-30 15:43                                             ` Nick Ing-Simmons
1999-06-30 15:43                                           ` Jeffrey A Law
1999-06-30 15:43                                         ` Linus Torvalds
1999-06-30 15:43                                       ` Tim Hollebeek
1999-06-30 15:43                                     ` Linus Torvalds
1999-06-30 15:43                                   ` mark
1999-06-07 13:34                                 ` Jamie Lokier
1999-06-30 15:43                                   ` Jamie Lokier
1999-06-30 15:43                                 ` Linus Torvalds
1999-06-30 15:43                               ` mark
1999-06-30 15:43                             ` Linus Torvalds
1999-06-30 15:43                           ` mark
1999-06-30 15:43                         ` Linus Torvalds
1999-06-30 15:43                       ` mark
1999-06-30 15:43                     ` Linus Torvalds
1999-06-30 15:43                   ` Richard Henderson
1999-06-30 15:43                 ` Linus Torvalds
1999-06-30 15:43               ` Tim Hollebeek
1999-06-04 15:02             ` Richard Henderson
1999-06-04 16:50               ` Bernd Schmidt
1999-06-30 15:43                 ` Bernd Schmidt
1999-06-05  9:35               ` Linus Torvalds
1999-06-05 13:34                 ` Richard Henderson
1999-06-05 18:40                   ` Linus Torvalds
1999-06-30 15:43                     ` Linus Torvalds
1999-06-05 21:38                   ` Jakub Jelinek
1999-06-30 15:43                     ` Jakub Jelinek
1999-06-30 15:43                   ` Richard Henderson
1999-06-30 15:43                 ` Linus Torvalds
1999-06-30 15:43               ` Richard Henderson
1999-06-30 15:43             ` Linus Torvalds
1999-06-03 23:53           ` Martin v. Loewis
1999-06-30 15:43             ` Martin v. Loewis
     [not found]           ` <v04205101b37d700fbf8d@[192.168.1.254]>
1999-06-04  7:01             ` craig
1999-06-30 15:43               ` craig
1999-06-30 15:43           ` craig
1999-06-30 15:43         ` David S. Miller
1999-06-03 13:31       ` Andi Kleen
1999-06-30 15:43         ` Andi Kleen
1999-06-30 15:43       ` mark
1999-06-30 15:43     ` David S. Miller
1999-06-03 12:02   ` Andi Kleen
1999-06-03 15:38     ` Martin v. Loewis
1999-06-30 15:43       ` Martin v. Loewis
1999-06-30 15:43     ` Andi Kleen
1999-06-30 15:43   ` mark
1999-06-30 15:43 ` Chip Salzenberg
1999-06-04 11:54 Mike Stump
1999-06-04 12:13 ` Jeffrey A Law
1999-06-04 13:25   ` Sylvain Pion
1999-06-04 13:32     ` Jeffrey A Law
1999-06-30 15:43       ` Jeffrey A Law
1999-06-30 15:43     ` Sylvain Pion
1999-06-30 15:43   ` Jeffrey A Law
1999-06-30 15:43 ` Mike Stump
1999-06-06 15:08 Ross Harvey
1999-06-06 15:46 ` Linus Torvalds
1999-06-30 15:43   ` Linus Torvalds
1999-06-06 17:29 ` David S. Miller
1999-06-30 15:43   ` David S. Miller
1999-06-30 15:43 ` Ross Harvey

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=Pine.LNX.3.95.990607083858.22237A-100000@penguin.transmeta.com \
    --to=torvalds@transmeta.com \
    --cc=chip@perlsupport.com \
    --cc=craig@jcb-sc.com \
    --cc=davem@redhat.com \
    --cc=egcs@egcs.cygnus.com \
    --cc=mark@codesourcery.com \
    --cc=rth@cygnus.com \
    --cc=tim@wagner.Princeton.EDU \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).