You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your example has UB because the c range is smaller than the a range. If you want to check for ranges of different lenghts you can use std::is_permutation(a.begin(), a.end(), c.begin(), c.end()).
demo.cpp
clang++ demo.cpp -O2
./a.out
echo $?
1
gdb ./a.out
0x0000aaaaaaaaa930 <+76>: ldr q0, [x10, #3520]
0x0000aaaaaaaaa934 <+80>: mov x1, x19
0x0000aaaaaaaaa938 <+84>: str w8, [sp, #32]
0x0000aaaaaaaaa93c <+88>: stp q0, q1, [sp]
0x0000aaaaaaaaa940 <+92>: bl 0xaaaaaaaaa968 <ZSt16__is_permutationIPKiS1_N9__gnu_cxx5__ops19_Iter_equal_to_iterEEbT_S5_T0_T1>
0x0000aaaaaaaaa944 <+96>: sub x0, x29, #0x20
0x0000aaaaaaaaa948 <+100>: mov x2, sp
0x0000aaaaaaaaa94c <+104>: mov x1, x19
=> 0x0000aaaaaaaaa950 <+108>: bl 0xaaaaaaaaa968 <ZSt16__is_permutationIPKiS1_N9__gnu_cxx5__ops19_Iter_equal_to_iterEEbT_S5_T0_T1>
0x0000aaaaaaaaa954 <+112>: and w0, w0, #0x1
0x0000aaaaaaaaa958 <+116>: ldp x29, x30, [sp, #80]
0x0000aaaaaaaaa95c <+120>: ldr x19, [sp, #96]
0x0000aaaaaaaaa960 <+124>: add sp, sp, #0x70
0x0000aaaaaaaaa964 <+128>: ret
End of assembler dump.
(gdb) x /5wx $x0
0xffffffffe940: 0x00000001 0x00000002 0x00000003 0x00000004
0xffffffffe950: 0x00000005
(gdb) x /5wx $x2
0xffffffffe910: 0x00000001 0x00000002 0x00000003 0x00000004
0xffffffffe920: 0x00000005
The same value is saved in the input space (x0 and x2)。
I look into the assemble and find that they may have used the same rodata.
The text was updated successfully, but these errors were encountered: