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: [PATCH] Fix PR14495 (1/2)


>  It also introduces the find_case_label_index helper which will be
>  needed in (2/2).

I am trying to port this to tuples and I find it a bit hard to understand.

You test for the fact that the returned idx is < start_idx. Since all
assignments to idx are "*idx = i", this is only possible if "i <
start_idx". "i" is assigned "start_idx" initially and "(high + low)/2"
in the loop. Since "low >= start_idx - 1", "(high + low)/2 <
start_idx" is only possible if "high = start_idx and low = start_idx -
1". This cannot happen since the loop condition is "high -low > 1".

Just to make sure I am not getting the math wrong, I added "gcc_assert
(i >= start_idx)" in all returns. The code is bootstrapping at stage3
now :-)

Cheers,
-- 
Rafael Avila de Espindola

Google Ireland Ltd.
Gordon House
Barrow Street
Dublin 4
Ireland

Registered in Dublin, Ireland
Registration Number: 368047


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