docs/misra: document gcc-specific behavior with shifting signed integers
PATCH v2 1/1 docs/misra: document gcc-specific behavior with shifting signed integers
From: Stefano Stabellini <[email protected]>
---
v2:
- split << and >>
- do not use the word "shift" instead of << or >>
--- docs/misra/C-language-toolchain.rst | 9 +++++++++ 1 file changed, 9 insertions(+)
docs/misra/C-language-toolchain.rst +9 -0
@@ -200,6 +200,15 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL + * - Signed << compiler-defined behavior + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11 + only to treat certain aspects of signed << as undefined. + + * - Signed >> acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. Translation Limits __________________
Signature · 1 line
2.25.1
Quoted 3 lines · Stefano Stabellini
From: Stefano Stabellini <[email protected]>
Signed-off-by Stefano Stabellini <[email protected]>
Hi Stefano,
Quoted 18 lines · Stefano Stabellini
From: Stefano Stabellini <[email protected]>
Signed-off-by Stefano Stabellini <[email protected]>---
v2:
- split << and >>
- do not use the word "shift" instead of << or >>--- docs/misra/C-language-toolchain.rst | 9 +++++++++ 1 file changed, 9 insertions(+)docs/misra/C-language-toolchain.rst +0
-0@@ -200,6 +200,15 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL
docs/misra/C-language-toolchain.rst The table columns are as follows: · line 211
Quoted 10 lines
docs/misra/C-language-toolchain.rst +9
-0+ * - Signed << compiler-defined behavior + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11 + only to treat certain aspects of signed << as undefined. + + * - Signed >> acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL.
I noticed that all this document is referring to GCC. But we also support CLang. Did you confirm that CLang abide with this behavior?
Cheers,
Signature · 1 line
Julien Grall
Quoted 26 lines · Julien Grall
Hi Stefano,
Quoted 23 lines · Stefano Stabellini
From: Stefano Stabellini <[email protected]>
Signed-off-by Stefano Stabellini <[email protected]>---
v2:
- split << and >>
- do not use the word "shift" instead of << or >>--- docs/misra/C-language-toolchain.rst | 9 +++++++++ 1 file changed, 9 insertions(+)docs/misra/C-language-toolchain.rst +3
-0@@ -200,6 +200,15 @@ The table columns are as follows: - ARM64, X86_64 - See Section "6.29 Designated Initializers" of GCC_MANUAL + * - Signed << compiler-defined behavior + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL. As an extension to the + C language, GCC does not use the latitude given in C99 and C11
Quoted 8 lines
docs/misra/C-language-toolchain.rst The table columns are as follows: · line 211
Quoted 5 lines
docs/misra/C-language-toolchain.rst +5
-0+ only to treat certain aspects of signed << as undefined. + + * - Signed >> acts on negative numbers by sign extension + - All architectures + - See Section "4.5 Integers" of GCC_MANUAL.I noticed that all this document is referring to GCC. But we also support CLang. Did you confirm that CLang abide with this behavior?
Hi Julien,
No, only GCC. The analysis and documentation so far has been done only for GCC, as you can see from all the various mentions and pointers to the GCC manual scattered through C-language-toolchain.rst. Actually I think it would be very useful for our users to do the same also for CLang, given that some safety compilers are based on CLang. And it would be very useful to know if there are any difference. If collectively we start to find corresponding references to the CLang manual we could add them one by one to C-language-toolchain.rst as we find them.