This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Fix powerpc64 g77


>> | If you saw this code:
>> |
>> |   if (TARGET_HAS_FOO) {
>> |     x = 1 / 0;
>> |   }
>> |
>> | and TARGET_HAS_FOO was 0, wouldn't you want a warning?
>>
>> No.  By no means.

>Well, we are definitely on opposite sides of the fence on this one.
>
>At some point down the road, we will have to get a community consensus
>so that we know what to do in our compiler.

What about the code:

  if (TARGET_HAS_FOO) {
    x = 1 / TARGET_HAS_FOO;
  }

That code is clearly legal.

If you can construct the warning machinery so it warns on your example
and not on my example, then that would be fine.  If not, then the
choice is either a false positive (a warning on my example where there
shouldn't be one) or a false negative (no warning on your example).

To choose between those two cases, you want to consider (a) which
false answer is less evil, (b) which example, yours or mine,
represents the more likely case in real world code.

The code fragment that started the debate is, I believe, analogous to
my example (i.e., if the condition is such that the shifts are in fact
executed, then they are valid because then the word length is long
enough).  So there's one real world example on the table that argues
for not generating the warning.  

	 paul


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]