search for: high_mask

Displaying 14 results from an estimated 14 matches for "high_mask".

2017 Jun 29
5
The undef story
...recently. To abstract the relevant parts, it looked something like this: >>> >>> template <typename T> >>> int do_something(T mask, bool cond) { >>> if (mask & 2) >>> return 1; >>> >>> if (cond) { >>> T high_mask = mask >> 48; >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else if (high_mask > 3) >>> do_something_2(); >>> } >>> >>> return 0; >>> } >>> >>> This function e...
2017 Jun 29
1
The undef story
...was >> working on recently. To abstract the relevant parts, it looked >> something like this: >> >> template <typename T> >> int do_something(T mask, bool cond) { >> if (mask & 2) >> return 1; >> >> if (cond) { >> T high_mask = mask >> 48; >> if (high_mask > 5) >> do_something_1(high_mask); >> else if (high_mask > 3) >> do_something_2(); >> } >> >> return 0; >> } >> >> This function ended up being instantiated on different ty...
2017 Jun 29
6
The undef story
...ant parts, it looked something like this: >>>> >>>> template <typename T> >>>> int do_something(T mask, bool cond) { >>>> if (mask & 2) >>>> return 1; >>>> >>>> if (cond) { >>>> T high_mask = mask >> 48; >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else if (high_mask > 3) >>>> do_something_2(); >>>> } >>>> >>>> return 0; >>>> } >>&g...
2017 Jun 30
3
The undef story
...ined behavior. Peter Lawrence. For reference here’s your second version with the plain “else” rather than “else if" void do_something_1(int); void do_something_2(); template <typename T> int do_something(T mask, bool cond) { if (mask & 2) return 42; if (cond) { T high_mask = mask >> 48; if (high_mask > 5) do_something_1(high_mask); else do_something_2(); } return 0; } char foo(); bool alwaysfalse(); char f = do_something<char>(foo(), alwaysfalse()); > On Jun 29, 2017, at 2:49 PM, Mehdi AMINI <joker.eph at gmail.com...
2017 Jun 29
8
The undef story
...omment on SPEC, but this does remind me of code I was working on recently. To abstract the relevant parts, it looked something like this: > > template <typename T> > int do_something(T mask, bool cond) { > if (mask & 2) > return 1; > > if (cond) { > T high_mask = mask >> 48; > if (high_mask > 5) > do_something_1(high_mask); > else if (high_mask > 3) > do_something_2(); > } > > return 0; > } > > This function ended up being instantiated on different types T (e.g. unsigned char, unsigned in...
2017 Jul 01
0
The undef story
...recently. To abstract the relevant parts, it looked something like this: >>> >>> template <typename T> >>> int do_something(T mask, bool cond) { >>> if (mask & 2) >>> return 1; >>> >>> if (cond) { >>> T high_mask = mask >> 48; >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else if (high_mask > 3) >>> do_something_2(); >>> } >>> >>> return 0; >>> } >>> Hal, yes, there are...
2017 Jul 24
2
GEP with a null pointer base
...again incorrect: there is no UB in the program, there is nothing the static analyzer should report. Hal’s example starts with this template > template <typename T> > int do_something(T mask, bool cond) { > if (mask & 2) > return 42; > > if (cond) { > T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true > if (high_mask > 5) > do_something_1(high_mask); > else > do_something_2(); > } > > return 0; > } Which is then instantiated with T = char, and where it is impossible f...
2017 Jul 27
2
GEP with a null pointer base
...there is nothing the static analyzer should report. > > > Hal’s example starts with this template > >> template <typename T> >> int do_something(T mask, bool cond) { >> if (mask & 2) >> return 42; >> >> if (cond) { >> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >> if (high_mask > 5) >> do_something_1(high_mask); >> else >> do_something_2(); >> } >> >> return 0; >> } > > > Which is then instantia...
2017 Jul 28
2
GEP with a null pointer base
...report. >> >> >> Hal’s example starts with this template >> >>> template <typename T> >>> int do_something(T mask, bool cond) { >>> if (mask & 2) >>> return 42; >>> >>> if (cond) { >>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>> if (high_mask > 5) >>> do_something_1(high_mask); >>> else >>> do_something_2(); >>> } >>> >>> return 0; >>> } >>...
2017 Jun 28
9
The undef story
Chandler, where we disagree is in whether the current project is moving the issue forward. It is not. It is making the compiler more complex for no additional value. The current project is not based in evidence, I have asked for any SPEC benchmark that shows performance gain by the compiler taking advantage of “undefined behavior” and no one can show that. The current project
2017 Jul 31
2
GEP with a null pointer base
...> Hal’s example starts with this template >>> >>>> template <typename T> >>>> int do_something(T mask, bool cond) { >>>> if (mask & 2) >>>> return 42; >>>> >>>> if (cond) { >>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else >>>> do_something_2(); >>>> } >>>> >>>> retur...
2017 Jul 22
2
GEP with a null pointer base
Mehdi, Hal’s transformation only kicks in in the *presence* of UB, and it does not matter how that UB got there, whether by function inlining or without function inlining. The problem with Hal’s argument is that the compiler does not have a built in ouija board with which it can conjure up the spirit of the author of the source code and find out if the UB was intentional with the
2017 Jul 31
4
GEP with a null pointer base
...t; Hal’s example starts with this template >>>> >>>> template <typename T> >>>> int do_something(T mask, bool cond) { >>>> if (mask & 2) >>>> return 42; >>>> >>>> if (cond) { >>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, >>>> and cond true >>>> if (high_mask > 5) >>>> do_something_1(high_mask); >>>> else >>>> do_something_2(); >>>> } >>>> >>...
2017 Aug 01
0
GEP with a null pointer base
...his template >>>> >>>>> template <typename T> >>>>> int do_something(T mask, bool cond) { >>>>> if (mask & 2) >>>>> return 42; >>>>> >>>>> if (cond) { >>>>> T high_mask = mask >> 48; // UB if sizeof(T) < 8, and cond true >>>>> if (high_mask > 5) >>>>> do_something_1(high_mask); >>>>> else >>>>> do_something_2(); >>>>> } >>>>>...