9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: dexen deVries <dexen.devries@gmail.com>
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: Re: [9fans] make passive aggressive gcc
Date: Mon, 15 Jun 2015 18:05:32 +0200	[thread overview]
Message-ID: <CAJUT6o7dhzEKH1eVFGTb_9dO02_Jm8C7C+hz=8RccJ7dEM_VCA@mail.gmail.com> (raw)
In-Reply-To: <CADuwikVv5wRY+5iKjujud-JvW5tF_-1o8npx_u51G48mzSkeug@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2157 bytes --]

>
> I don't know what gcc authors are smoking, but "strcpy(tmp,
> "what.");" will be compiled to a few mov instructions with -O0, while
> -Os still has a call to strcpy, just the way it *should* always be,
> imho.


not that it's any excuse, but -fno-builtin helps.

On Mon, Jun 15, 2015 at 4:56 PM, Siarhei Zirukin <ftrvxmtrx@gmail.com>
wrote:

> On Mon, Jun 15, 2015 at 3:41 PM, Ethan Grammatikidis
> <eekee57@fastmail.fm> wrote:
> > On Mon, 15 Jun 2015 09:21:56 +0100
> > Charles Forsyth <charles.forsyth@gmail.com> wrote:
> >
> >> If you're using gcc 4.8.2 to compile ... anything, really ... but
> certainly
> >> Plan 9 or Inferno components,
> >> and those use for loops with arrays, be sure to include the compilation
> >> options
> >> -fno-strict-aliasing\
> >> -fno-aggressive-loop-optimizations\
> >> and it will save you some time and effort.
> >> It will save compilation time (not that you'll notice with that
> sluggard)
> >> because it won't
> >> fuss even more with your program, and it will save effort, because you
> >> won't have
> >> to debug simple loops that have bounds changed, are removed completely,
> or
> >> otherwise wrecked.
> >> You can find discussions of it elsewhere (which is how I found compiler
> >> options to stop it).
> >> I'd forgotten all about it until it surfaced again.
> >
> > Thanks. Reminds me I liked gcc when it applied very few optimizations.
> > I guess it must have been focused on machine-specific optimizations
> > back in 2007/2008. I had a cpu newer than gcc had support for, and
> > compilation was actually quick. Anyone know if -O0 is a reasonable
> > option these days? (I mean tested well enough to be reasonably
> > bug-free.)
>
> I've recenetly seen a few examples where -O0 would produce a
> segfaulting executable, while any other -Ox would work fine.
> Also, I don't know what gcc authors are smoking, but "strcpy(tmp,
> "what.");" will be compiled to a few mov instructions with -O0, while
> -Os still has a call to strcpy, just the way it *should* always be,
> imho. I just checked this once again (gcc-4.8.4) and it still applies.
>
>

[-- Attachment #2: Type: text/html, Size: 3018 bytes --]

  parent reply	other threads:[~2015-06-15 16:05 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-15  8:21 Charles Forsyth
2015-06-15 13:41 ` Ethan Grammatikidis
2015-06-15 14:56   ` Siarhei Zirukin
2015-06-15 15:37     ` Ethan Grammatikidis
2015-06-15 16:05     ` dexen deVries [this message]
2015-06-15 14:41 ` Ryan Gonzalez
2015-06-15 23:06 ` [9fans] Wildly off-topic Andrew Simmons
2015-06-15 23:15   ` Ryan Gonzalez
2015-06-15 23:22   ` Bakul Shah
2015-06-16  3:35     ` Ramakrishnan Muthukrishnan
2015-06-15 23:39   ` Kurt H Maier

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='CAJUT6o7dhzEKH1eVFGTb_9dO02_Jm8C7C+hz=8RccJ7dEM_VCA@mail.gmail.com' \
    --to=dexen.devries@gmail.com \
    --cc=9fans@9fans.net \
    /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 NNTP newsgroup(s).