> When doing bootstrap with -fsanitize=undefined, I noticed undefined
> behavior in this file. We basically do 1 << 32, since NUM_CONDITIONS
> is #defined to 32, which is not defined. I admit I didn't followed
> the algorithm at all, but this patch passed bootstrap + regtesting
> on x86_64-linux. So, ok for trunk?
>
> 2013-08-13 Marek Polacek <pola...@redhat.com>
>
> * ipa-inline-analysis.c (add_clause): Avoid undefined behavior
> when shifting integer.
OK, thanks!
Honza
>
> --- gcc/ipa-inline-analysis.c.mp 2013-08-13 14:07:48.632662047 +0200
> +++ gcc/ipa-inline-analysis.c 2013-08-13 14:08:16.728770973 +0200
> @@ -337,7 +337,7 @@ add_clause (conditions conditions, struc
> and thus there is no point for looking for them. */
> if (cc1->code == CHANGED || cc1->code == IS_NOT_CONSTANT)
> continue;
> - for (c2 = c1 + 1; c2 <= NUM_CONDITIONS; c2++)
> + for (c2 = c1 + 1; c2 < NUM_CONDITIONS; c2++)
> if (clause & (1 << c2))
> {
> condition *cc1 =
>
> Marek