(j3.2006) [Re: Spreadsheet from meeting 167]

Tobias Burnus burnus
Sat Nov 3 19:00:29 EDT 2012


Dan Nagle wrote:
> I believe it is a misstatement to say that J3 spent significant 
> amounts of time on the annex for 24772. [...] In any case, the affect 
> on compiler suppliers so far is exactly zero

I disagree, given that the suggestions in the annex lead to the addition 
of the following two new warning flags in GCC/gfortran 4.8:

  *

    The -Wcompare-reals flag has been added. When this flag is set,
    warnings are issued when comparing REAL or COMPLEX types for
    equality and inequality; consider, where appropriate, to replace
    a == b by abs(a-b) < eps with a suitable eps. This flag is implied
    by -Wextra.

  *

    The -Wtarget-lifetime flag has been added (enabled with -Wall),
    which warns if the pointer in a pointer assignment might outlive its
    target. This flag is implied by -Wall.

Regarding -Wcompare-reals. Testing the flag with real-world code shows 
that such comparisons occur very frequently (~150 times in medium-sized 
codes of ~150,000 LOC) and, so far, all code looked fine: the values 
were exactly representable integers (1.0, 0.0) or matched the value 
previously assigned (mostly: 0.0). Thus, the flags belongs into the 
category: If one has time, one can use it once in a while, but not 
regularly as one is drowned in false positives. (It falls in the same 
category as having a warning for any numeric kind/type conversions 
[gfortran: -Wconversion-extra], while warnings for narrowing conversion 
[gfortran: -Wconversion] have way less false positives.)

(The -Wtarget-lifetime is more useful; a simple compile-time warning 
won't be able to find the important hard cases, but at least slip of 
minds like pointer assigning a local variable to a function result.)


Otherwise, TR 24772 is mostly about suggestions to the users and, thus, 
it doesn't affect the standardization or compiler development. Although, 
there are some suggestions for future development at the end of the 
appendix. I think the TR is useful, though I assume that most readers of 
the TR do not need the advices any more - and others won't read it. I 
cannot comment on amount of time spend on drafting the appendix, 
especially not with regards to the J3/WG5 meetings.

Tobias



More information about the J3 mailing list