This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gomp] PR24505 mixed types in predicate
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: dnovillo at redhat dot com, rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Mon, 31 Oct 2005 02:52:50 -0500
- Subject: Re: [gomp] PR24505 mixed types in predicate
- References: <20051030203501.GA17778@redhat.com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sun, Oct 30, 2005 at 04:35:01PM -0400, Aldy Hernandez wrote:
> Hi guys!
>
> 2.5.1 specifies that the condition in a for loop is computed in the
> type of the loop variable, otherwise the behavior is undefined.
>
> This patch fixes the problem in PR24505.
>
> Bootstrapped and regtested on ppc-linux for C and C++.
I think a warning should be issued in that case, unless in
iteration_var relational_op b
the compiler can prove that (__typeof (iteration_var)) b == b,
similarly to how we warn about iteration var being unsigned.
If b is unsigned, the warning should be IMHO unconditional though,
unless iteration_var is already unsigned too (which means we warned
already).
So say
#pragma omp for
for (int i = 0; i < 10L; i++)
...
would not warn.
Have you tried also b having floating point type?
#pragma omp for
for (int i = 0; i < 10.2; i++)
...
> PR gomp/24505
> * c-omp.c (c_finish_omp_for): Canonicalize condition.
> * testsuite/gcc.dg/gomp/for-15.c: New.
Jakub