Jump to page: 1 24  
Page
Thread overview
Recommendation: Compile DMD with More Warnings
Apr 06, 2014
Nordlöw
Apr 06, 2014
Orvid King
Apr 06, 2014
bearophile
Apr 06, 2014
Nordlöw
Apr 06, 2014
bearophile
Apr 06, 2014
Nordlöw
Apr 06, 2014
David Nadlinger
Apr 07, 2014
Iain Buclaw
Apr 07, 2014
Walter Bright
Apr 07, 2014
Brad Roberts
Apr 07, 2014
Suliman
Apr 07, 2014
Iain Buclaw
Apr 07, 2014
Daniel Murphy
Apr 07, 2014
bearophile
Apr 07, 2014
Nordlöw
Apr 07, 2014
Daniel Murphy
Apr 07, 2014
Nordlöw
Apr 08, 2014
Daniel Murphy
Apr 07, 2014
asman
Apr 07, 2014
bearophile
Apr 07, 2014
Walter Bright
Apr 07, 2014
Orvid King
Apr 07, 2014
Walter Bright
Apr 07, 2014
asman
Apr 07, 2014
Walter Bright
Apr 08, 2014
H. S. Teoh
Apr 08, 2014
Mike Parker
Apr 08, 2014
Dicebot
Apr 08, 2014
John Colvin
Apr 09, 2014
Orvid King
Apr 09, 2014
Walter Bright
April 06, 2014
I recommend the lead developers of DMD to look into activating more warnings in the dmd/src/posix.mak.

GCC 4.8.2 and especially Clang 3.4, both prepackage on Ubuntu 13.10/14.04 give a *lot* of warnings that seems to indicate potential bugs in the DMD source code.

This setting gives useful warnings and at the same time avoid the annoying ones

WARNINGS=-Wall -Wextra -Wno-deprecated -Wstrict-aliasing -Wno-unused-parameter -Wno-unused-variable -Wunused-function -Wno-unused-label -Wno-unknown-pragmas -Wno-sign-compare -Wno-overloaded-virtual -Wno-missing-braces -Wno-missing-field-initializers -Wno-logical-op-parentheses

For example there a *lot* of -Wsometimes-uninitialized which IMHO seems like the most dangereous ones. This one is however Clang specific but I have not had any problems running a Clang compiled version of DMD. Further Clang compiles DMD about twices as fast as GCC. Good work developers on disabling use of STL in DMD!

I can do a pull request if desired for the posix.make update if wanted.
April 06, 2014
On 4/6/14, 2:49 AM, "Nordlöw" wrote:
> I recommend the lead developers of DMD to look into activating more
> warnings in the dmd/src/posix.mak.
>
> GCC 4.8.2 and especially Clang 3.4, both prepackage on Ubuntu
> 13.10/14.04 give a *lot* of warnings that seems to indicate potential
> bugs in the DMD source code.
>
> This setting gives useful warnings and at the same time avoid the
> annoying ones
>
> WARNINGS=-Wall -Wextra -Wno-deprecated -Wstrict-aliasing
> -Wno-unused-parameter -Wno-unused-variable -Wunused-function
> -Wno-unused-label -Wno-unknown-pragmas -Wno-sign-compare
> -Wno-overloaded-virtual -Wno-missing-braces
> -Wno-missing-field-initializers -Wno-logical-op-parentheses
>
> For example there a *lot* of -Wsometimes-uninitialized which IMHO seems
> like the most dangereous ones. This one is however Clang specific but I
> have not had any problems running a Clang compiled version of DMD.
> Further Clang compiles DMD about twices as fast as GCC. Good work
> developers on disabling use of STL in DMD!
>
> I can do a pull request if desired for the posix.make update if wanted.

I'm not a regular core dmd dev but I'm already seeing warnings with clang on OSX and I think fixing them would be beneficial. I'd support a pull request. In all likelihood it would also need to fix the warnings themselves, so you may want to enable only a few warnings at a time so as to keep the pull request sizes manageable. -- Andrei
April 06, 2014
On Sunday, 6 April 2014 at 16:27:50 UTC, Andrei Alexandrescu wrote:
> On 4/6/14, 2:49 AM, "Nordlöw" wrote:
>> I recommend the lead developers of DMD to look into activating more
>> warnings in the dmd/src/posix.mak.
>>
>> GCC 4.8.2 and especially Clang 3.4, both prepackage on Ubuntu
>> 13.10/14.04 give a *lot* of warnings that seems to indicate potential
>> bugs in the DMD source code.
>>
>> This setting gives useful warnings and at the same time avoid the
>> annoying ones
>>
>> WARNINGS=-Wall -Wextra -Wno-deprecated -Wstrict-aliasing
>> -Wno-unused-parameter -Wno-unused-variable -Wunused-function
>> -Wno-unused-label -Wno-unknown-pragmas -Wno-sign-compare
>> -Wno-overloaded-virtual -Wno-missing-braces
>> -Wno-missing-field-initializers -Wno-logical-op-parentheses
>>
>> For example there a *lot* of -Wsometimes-uninitialized which IMHO seems
>> like the most dangereous ones. This one is however Clang specific but I
>> have not had any problems running a Clang compiled version of DMD.
>> Further Clang compiles DMD about twices as fast as GCC. Good work
>> developers on disabling use of STL in DMD!
>>
>> I can do a pull request if desired for the posix.make update if wanted.
>
> I'm not a regular core dmd dev but I'm already seeing warnings with clang on OSX and I think fixing them would be beneficial. I'd support a pull request. In all likelihood it would also need to fix the warnings themselves, so you may want to enable only a few warnings at a time so as to keep the pull request sizes manageable. -- Andrei

If you want, I have the results of a static analysis of DMD that I could post, as processed in 23 hours and 58 minutes by Intel's C compiler, using 10gb of RAM the entire time. If I can figure out how to have it not skip any methods (there were still a significant number that it didn't analyze due to complexity limits) I'll run it again and post the full results. In my basic look over the results, there were a decent number of them that may actually be bugs. (buffer overruns, and even a few instances of accessing memory after it had been freed)

On the topic of actual warnings, I would be careful with them, because compiling DMD with MSVC with the maximum warning level (essentially -Wall), it produces 150k lines of output, most of them about stuff being inlined, and quite a bit of other stuff that you quite simply, don't care about.
April 06, 2014
Orvid King:

> On the topic of actual warnings, I would be careful with them, because compiling DMD with MSVC with the maximum warning level (essentially -Wall), it produces 150k lines of output, most of them about stuff being inlined, and quite a bit of other stuff that you quite simply, don't care about.

I'd like dmd/ldc2 compilers to compile with warnings active on default, plus to have a switch to disable them.

Bye,
bearophile
April 06, 2014
On Sunday, 6 April 2014 at 17:39:38 UTC, bearophile wrote:
> Orvid King:
>
>> On the topic of actual warnings, I would be careful with them, because compiling DMD with MSVC with the maximum warning level (essentially -Wall), it produces 150k lines of output, most of them about stuff being inlined, and quite a bit of other stuff that you quite simply, don't care about.
>
> I'd like dmd/ldc2 compilers to compile with warnings active on default, plus to have a switch to disable them.
>
> Bye,
> bearophile

Could you give me a priority list of the typical warning types sorted an descending severity?

/Per
April 06, 2014
On Sunday, 6 April 2014 at 17:39:38 UTC, bearophile wrote:
> I'd like dmd/ldc2 compilers to compile with warnings active on default, plus to have a switch to disable them.

LDC is actually built with -Wall -Wextra by default. The warnings are disabled for the DMD source files though, as leaving them on just floods the console output, making actual issues much harder to see.

We will have to look into additionally adding warning push/pop pragmas around the frontend includes in the "proper" LDC source files though. Currently, we get quite a bit of log spam from them, and some of them are unlikely to be addressed in the upstream source.

David
April 06, 2014
Nordlöw:

> Could you give me a priority list of the typical warning types sorted an descending severity?

I can't, I don't understand your question, and I don't understand why you want such list.

Bye,
bearophile
April 06, 2014
> I can't, I don't understand your question, and I don't understand why you want such list.

Just so I know where I should begin digging ;)
April 07, 2014
On 6 Apr 2014 21:15, "David Nadlinger" <code@klickverbot.at> wrote:
>
> On Sunday, 6 April 2014 at 17:39:38 UTC, bearophile wrote:
>>
>> I'd like dmd/ldc2 compilers to compile with warnings active on default,
plus to have a switch to disable them.
>
>
> LDC is actually built with -Wall -Wextra by default. The warnings are
disabled for the DMD source files though, as leaving them on just floods the console output, making actual issues much harder to see.
>
> We will have to look into additionally adding warning push/pop pragmas
around the frontend includes in the "proper" LDC source files though. Currently, we get quite a bit of log spam from them, and some of them are unlikely to be addressed in the upstream source.
>

You should have more abstraction in LDC between the two frontend layers. :)


April 07, 2014
Who could explain. AFAIK D was position as language without warnings. The idea was in that code maybe correct or wrong, without any intermediate state, and now I am reading about warnings.
« First   ‹ Prev
1 2 3 4