Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
ultramiraculous
Nov 12, 2003

"No..."
Grimey Drawer

HORATIO HORNBLOWER posted:

Compiling C without -Wall -Werror or the moral equivalent is a horror.

What's funny is you still don't catch this with -Wall. To get -Wunreachable-code turned on you have to compile with -Weverything :smug:

Adbot
ADBOT LOVES YOU

evensevenone
May 12, 2001
Glass is a solid.
-Wall doesn't include the unreachable code check (at least in GCC, and probably clang).

Now that I think about it, that could have been caused by a hosed up merge; merge tools are good but they're not perfect. In that case it probably would have passed code review (since most teams review diffs). Still, you'd think a unit test / regression test would have caught it.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Yeah, considering it was only in that one published revision and not any before or after, it was certainly a bad merge.

The guy who found that line of code must have screamed after realizing what happened.

apseudonym
Feb 25, 2011

evensevenone posted:

-Wall doesn't include the unreachable code check (at least in GCC, and probably clang).

Now that I think about it, that could have been caused by a hosed up merge; merge tools are good but they're not perfect. In that case it probably would have passed code review (since most teams review diffs). Still, you'd think a unit test / regression test would have caught it.

I'd bet on someone trying to remove an if and forgetting the statement. The diff between versions has a lot of code cleanup.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
https://gist.github.com/alexyakoubian/9151610/revisions (line 631)

There's no other changes near it, so it's not really clear what happened.

Dren
Jan 5, 2001

Pillbug

Plorkyeran posted:

https://gist.github.com/alexyakoubian/9151610/revisions (line 631)

There's no other changes near it, so it's not really clear what happened.

My bet is on a copy-paste mistake while refactoring and moving those if statements around.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Dren posted:

My bet is on a copy-paste mistake while refactoring and moving those if statements around.

Alternately, :nsa:

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
Time for the peanut gallery to weigh in. First up, Nadim Kobeissi, the widely respected 15-year-old crypto genius: http://log.nadim.cc/?p=126

quote:

It’s interesting to note that had the programmer used an initial if statement in that method followed by else if statements, their code would not only most likely be more efficient when compiled, but the second goto fail statement would have been detected as invalid by the compiler. This vulnerability would have then been avoided. But the programmer went for a less efficient method which made the bug possible.

Swing and a miss.

ExcessBLarg!
Sep 1, 2001

Suspicious Dish posted:

Swing and a miss.
The efficiency claims are dubious, but he's correct in the sense the compiler would've errored due to an else without a previous if.

I would still use braces myself.

apseudonym
Feb 25, 2011

Suspicious Dish posted:

Time for the peanut gallery to weigh in. First up, Nadim Kobeissi, the widely respected 15-year-old crypto genius: http://log.nadim.cc/?p=126


Swing and a miss.

Who is this person because they missed the point so drat hard.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
http://en.wikipedia.org/wiki/Nadim_Kobeissi

http://en.wikipedia.org/wiki/Cryptocat#Security_concerns

http://tobtu.com/decryptocat.php

Suspicious Dish fucked around with this message at 22:29 on Feb 22, 2014

apseudonym
Feb 25, 2011


Cryptocat still makes me really angry especially how the startup community responded to it being completely broken.

gently caress that guy.


Also if you think an if else is faster than if goto I really have to wonder what you think the compiler output is.

E:if you do build error handling into an if else chain of doom you are a bad person and should feel bad. Very very bad.

tef
May 30, 2004

-> some l-system crap ->

Saw him talk once, haven't been so angry in a while.

"Look my software isn't great, sure there was that bug that meant all traffic for the last year could be decrypted without a key, It's experimental and people shouldn't use it"

"By the way look at all the people who are using my software, isn't it cool"

or you know what's cool: putting people's lives at stake. that's cool.

apseudonym
Feb 25, 2011

tef posted:

Saw him talk once, haven't been so angry in a while.

"Look my software isn't great, sure there was that bug that meant all traffic for the last year could be decrypted without a key, It's experimental and people shouldn't use it"

"By the way look at all the people who are using my software, isn't it cool"

or you know what's cool: putting people's lives at stake. that's cool.

How did you not punch him in the face?

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

apseudonym posted:

How did you not punch him in the face?

Human decency and self-restraint?

Don Mega
Nov 26, 2005
Throw a shoe at him next time.

Coffee Mugshot
Jun 26, 2010

by Lowtax
Coding horrors thread: throwing shoes at 15 year olds

Don Mega
Nov 26, 2005
He's 24 years old according to the wiki.

evensevenone
May 12, 2001
Glass is a solid.

Plorkyeran posted:

https://gist.github.com/alexyakoubian/9151610/revisions (line 631)

There's no other changes near it, so it's not really clear what happened.

is that the actual revision history, or just the revision history of that gist?

ExcessBLarg!
Sep 1, 2001

apseudonym posted:

E:if you do build error handling into an if else chain of doom you are a bad person and should feel bad. Very very bad.
I read it as using "else if" in conjunction with the existing gotos, not in place of the gotos.

Which yeah, would've resulted in a compile error in this particular case. But there's better solutions such that the "else if" commentary wasn't really worth him making.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

evensevenone posted:

is that the actual revision history, or just the revision history of that gist?
Apple provides periodic code dumps of that library, and that's the diff between two of the dumps. There could have been multiple revisions to the file in between the dumps.

Doc Hawkins
Jun 15, 2010

Dashing? But I'm not even moving!


Don Mega posted:

He's 24 years old according to the wiki.

Among my people the tradition is one shoe per year of age.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
https://twitter.com/SecureTips/status/437636832403001344

Internet Janitor
May 17, 2008

"That isn't the appropriate trash receptacle."
The manual page for goto in PHP begins with an XKCD comic. Amazing.

Hughlander
May 11, 2005

Internet Janitor posted:

The manual page for goto in PHP begins with an XKCD comic. Amazing.

Makes sense both are overused unfunny "jokes" that have long sense outstayed their welcome.

qntm
Jun 17, 2009

ultramiraculous posted:

What's funny is you still don't catch this with -Wall. To get -Wunreachable-code turned on you have to compile with -Weverything :smug:

The -Wall doesn't turn on all warnings? -Wall and -Weverything do two different things? How is that not a horror?

PHP was rightly ridiculed for exactly the same behaviour.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

qntm posted:

The -Wall doesn't turn on all warnings? -Wall and -Weverything do two different things? How is that not a horror?

And -ansi -pedantic doesn't flag every use of a gcc extension as a warning or error.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed

Plorkyeran posted:

gcc can't add things to -Wall because that breaks all the terrible projects that have -Werror in their default CFLAGS and the users throw a shitstorm. Clang might be able to get away with it due to that there's a lot less legacy code being compiled with it.

-Weverything also shows that you don't actually want to enable all warnings. I wouldn't be surprised if there's some contradictory warnings.

shrughes
Oct 11, 2008

(call/cc call/cc)
There are at least contradictory warnings across different compilers.

Not So Fast
Dec 27, 2007


Hughlander posted:

Makes sense both are overused unfunny "jokes" that have long sense outstayed their welcome.

All three of those things, in fact.

Volmarias
Dec 31, 2002

EMAIL... THE INTERNET... SEARCH ENGINES...

Hughlander posted:

Makes sense both are overused unfunny "jokes" that have long sense outstayed their welcome.

What's ridiculous is that PHP uses the xkcd comic as a warning not to use goto, and then never expounds on it. Newbie developers will see that, laugh, and assume that it's an exaggeration, before making awful spaghetti code because they don't know any better.

MrMoo
Sep 14, 2000

Otto Skorzeny posted:

And -ansi -pedantic doesn't flag every use of a gcc extension as a warning or error.

There are vanilla and gnu variations of each language standard using the "-std=c89/gnu89" parameter. But then the man page says "-ansi" is supposed to be equivalent, I guess you should be logging bugs if extensions are not caught.

MrMoo fucked around with this message at 22:07 on Feb 23, 2014

Westie
May 30, 2013



Baboon Simulator

Volmarias posted:

What's ridiculous is that PHP uses the xkcd comic as a warning not to use goto, and then never expounds on it. Newbie developers will see that, laugh, and assume that it's an exaggeration, before making awful spaghetti code because they don't know any better.

Whereas all experienced devs will look on at goto for the dinosaur it is.

Blotto Skorzany
Nov 7, 2008

He's a PSoC, loose and runnin'
came the whisper from each lip
And he's here to do some business with
the bad ADC on his chip
bad ADC on his chiiiiip

MrMoo posted:

There are vanilla and gnu variations of each language standard using the "-std=c89/gnu89" parameter. But then the man page says "-ansi" is supposed to be equivalent, I guess you should be logging bugs if extensions are not caught.

No, filing bugs will accomplish nothing here. It's by design (read: rms diktat) and implied in the name that the -pedantic switch does not work right, cf. the manual:

quote:

`-pedantic' does not cause warning messages for use of the
alternate keywords whose names begin and end with `__'. Pedantic
warnings are also disabled in the expression that follows
`__extension__'. However, only system header files should use
these escape routes; application programs should avoid them.
*Note Alternate Keywords::.

This option is not intended to be useful; it exists only to satisfy
pedants who would otherwise claim that GCC fails to support the
ANSI standard.

Some users try to use `-pedantic' to check programs for strict ANSI
C conformance. They soon find that it does not do quite what they
want
: it finds some non-ANSI practices, but not all--only those
for which ANSI C *requires* a diagnostic.

A feature to report any failure to conform to ANSI C might be
useful in some instances, but would require considerable
additional work and would be quite different from `-pedantic'. We
recommend, rather, that users take advantage of the extensions of
GNU C and disregard the limitations of other compilers. Aside
from certain supercomputers and obsolete small machines, there is
less and less reason ever to use any other C compiler other than
for bootstrapping GNU CC
."

e: expanded quote slightly

Blotto Skorzany fucked around with this message at 22:33 on Feb 23, 2014

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Volmarias posted:

What's ridiculous is that PHP uses the xkcd comic as a warning not to use goto, and then never expounds on it. Newbie developers will see that, laugh, and assume that it's an exaggeration, before making awful spaghetti code because they don't know any better.

As if newbies would read the manual.

Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe

Otto Skorzeny posted:

e: expanded quote slightly

Dear Oracle: please let suncc die a good death.

coffeetable
Feb 5, 2006

TELL ME AGAIN HOW GREAT BRITAIN WOULD BE IF IT WAS RULED BY THE MERCILESS JACKBOOT OF PRINCE CHARLES

YES I DO TALK TO PLANTS ACTUALLY

Otto Skorzeny posted:

quote:

We recommend, rather, that users take advantage of the extensions of
GNU C and disregard the limitations of other compilers. Aside
from certain supercomputers and obsolete small machines, there is
less and less reason ever to use any other C compiler other than
for bootstrapping GNU CC."

Hahah, this is even better in the context of his Clang/LLVM post from a while back.

Coffee Mugshot
Jun 26, 2010

by Lowtax
Yeah, that's right, I compile with -Wall and -pedantic
Then I get mad and type `python` 'cause I ain't got time for semantics

Jewel
May 2, 2009

While we're on the topic, I just want to say I love that all the warning flags start with W, because they almost always make words. I always pronounce them as they're written, so "wall", "weverything", "wunreachable" :3:

Adbot
ADBOT LOVES YOU

vOv
Feb 8, 2014

You can't spell -funroll-loops without 'fun'!

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply