• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function )
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function )


  • Subject: Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function )
  • From: "Sean McBride" <email@hidden>
  • Date: Sat, 10 Jul 2010 23:09:33 -0400

Jocelyn Houle (email@hidden) on 2010-07-10 08:11 said:

>According to:
>  http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
>GCC has a -Winit-self which, when using with -Wuninitialized, should
>have warned you.
>
>I looked back in the previous GCC versions doc, and found it even in GCC 4.2:
>  http://gcc.gnu.org/onlinedocs/gcc-4.2.0/gcc/Warning-Options.html
>(and even earlier).  But using it doesn't seem to work.
>
>So even though the C/C++ spec might not require a warning, the GCC folks
>clearly wanted to allow it, but it seems broken.

gcc-4.2 warns for me:

$ gcc-4.2 -Wuninitialized -O1 test.c
$ gcc-4.2 -Wuninitialized -O1 -Winit-self test.c
test.c: In function ‘main’:
test.c:3: warning: ‘x’ is used uninitialized in this function

Also, the clang static analyzer warns:

warning: Assigned value is garbage or undefined
         int x = x;
         ^       ~

Of course, it doesn't support C++, so that doesn't help Eric.

clang, the compiler, (trunk r108066) does not seem to warn, which is a pity.

Sean

--
"When the winds of change are blowing, some people are building shelters
and others are building windmills" - Chinese proverb
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Controlling optimization level per function (From: Eric Gorr <email@hidden>)
 >Re: Controlling optimization level per function (From: "Sean McBride" <email@hidden>)
 >Re: Controlling optimization level per function (From: Eric Gorr <email@hidden>)
 >Re: Controlling optimization level per function (From: "Sean McBride" <email@hidden>)
 >Re: Controlling optimization level per function (From: Eric Gorr <email@hidden>)
 >Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function ) (From: Eric Gorr <email@hidden>)
 >Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function ) (From: Mark Wagner <email@hidden>)
 >Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function ) (From: Eric Gorr <email@hidden>)
 >Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function ) (From: Jocelyn Houle <email@hidden>)

  • Prev by Date: WebKit Example?
  • Next by Date: Re: WebKit Example?
  • Previous by thread: Re: Compiler Weirdness and possible bug ( was Re: Controlling optimization level per function )
  • Next by thread: Re: Controlling optimization level per function
  • Index(es):
    • Date
    • Thread