Question unused function parameter data garbage collection

2022-09-12 Thread Fredrik Hederstierna via Gcc
Hi, We have a function that does not used an in-parameter, simplified example: void test_unused_string_param_gc(const char* unused) { // empty } Though when we have calls to this function, the arguments are still put in the memory, causing unnecessary flash memory usage for 'dead parameters'

Question about missing array bounds check

2021-09-15 Thread Fredrik Hederstierna via Gcc
I have a question about array index bounds check that I do not fully understand. Compiling the code below, I get warnings for out-of-bounds in one case, but not the other, also printf output gets different, but should be same? Maybe someone can explain what is going on, and if observed behavior is

Re: ARM peephole2 from 2003 never merged, still valid

2019-07-07 Thread Fredrik Hederstierna
> From: Segher Boessenkool > Sent: Thursday, June 6, 2019 6:49 PM > To: Richard Earnshaw (lists) > Cc: Fredrik Hederstierna; Jeff Law; gcc@gcc.gnu.org > Subject: Re: ARM peephole2 from 2003 never merged, still valid >   > > On Thu, Jun 06, 2019 at 05:06:35PM

Re: ARM peephole2 from 2003 never merged, still valid

2019-06-06 Thread Fredrik Hederstierna
> From: Segher Boessenkool > Sent: Thursday, June 6, 2019 4:02 PM > To: Richard Earnshaw (lists) > Cc: Jeff Law; Fredrik Hederstierna; gcc@gcc.gnu.org > Subject: Re: ARM peephole2 from 2003 never merged, still valid   > That doesn't stop combine from considering it.  It d

Re: ARM peephole2 from 2003 never merged, still valid

2019-06-01 Thread Fredrik Hederstierna
b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-01 Fredrik Hederstierna +Tamas Gergely + + * gcc/config/arm/arm.md: new peephole2 pattern added for extending + move and compare parallelization. Retake from 2003 patch adapted. + 2019-06-01 Martin Sebor PR middle-end

ARM peephole2 from 2003 never merged, still valid

2019-06-01 Thread Fredrik Hederstierna
patch: diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 20bdc2bec37..4c924499ad9 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-06-01 Fredrik Hederstierna +Tamas Gergely + + * gcc/config/arm/arm.md: new peephole2 pattern added for extending + move

Question about GCC not warning for some noncompliant SEI CERT C code examples

2019-05-30 Thread Fredrik Hederstierna
Hi When reading the SEI CERT C Coding Standard rules, looking at "DCL30-C. Declare objects with appropriate storage durations" it seem like GCC does not warn in compile-time for some noncompliant examples. I know eg AddressSanitizer and several runtime running tools finds these bugs, but it would

Question about GCC benchmarks and uninitialized variables

2018-07-24 Thread Fredrik Hederstierna
Hi This is a general question to all you working with GCC benchmarking. I have been working with code benchmarks like CSiBE for ARM. >From time to time unpredicted results appears where numbers gets worse by no >reason. When looking into what could cause this unpredictable behaviour, I found th

Question about loop induction variables

2017-05-07 Thread Fredrik Hederstierna
Hi, I have a question about loop induction variables, related to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67213 Consider a simple loop like int ix; for (ix = 0; ix < 6; ix++) { data[ix] = ix; } In this case variable 'ix' is used as counting variable for array index, but also used

Re: Question about usage of r12 (ip) on ARM

2016-08-29 Thread Fredrik Hederstierna
>> Couldn't this be compiled to as the following, with using r12 'ip': >> >> : >> 0: push {r4, lr} >> 4: mov r4, r0 >> 8: ldr ip, [r0] >> c: bl 0 >> 10: str ip, [r4] >> 14: pop {r4, pc} >> > >No. IP cna be clobbered either by func i

Question about usage of r12 (ip) on ARM

2016-08-28 Thread Fredrik Hederstierna
Hi, I from time to time get the impression that the inter procedure scratch register r12 (ip) is not used as often as it might on ARM. Example, compiled with GCC-6.2 for arm966e-s ARM with arm-none-eabi-gcc target: struct data { int flags; }; extern void* func(struct data* dp); struct data*

Question about Cortex bit-banding feature

2016-07-29 Thread Fredrik Hederstierna
Some processor architectures do support bitwise access to memory, eg. ARM Cortex-M and 8051 (by ARM called bit-banding). In these architectures a single bit can somewhat be addressable, but only as an 'aliased' memory region for another memory address. I noticed that Keil ARMCC compiler now seem

Re: Warn if making external references to local stack memory?

2012-04-10 Thread Fredrik Hederstierna
>> GCC does warn if returning a pointer to a local variable (stack memory). >> But there are alot of more cases where GCC could possibly warn, >> eg. when references are made to local variables or stack memory. >> >> See this attached example code. >> GCC warns for first case, but not the others.

Question about -Wnonnull

2012-03-09 Thread Fredrik Hederstierna
f(p = NULL); /* No warning? */ f((const char*)NULL); /* gives warning */ f(NULL); /* gives warning */ return 0; } static void f(const char *s) { printf("%s",s); } Thanks & Best Regards Fredrik Hederstierna

SV: Re: MISRA C support for GCC?

2005-11-21 Thread Fredrik Hederstierna
> Not that I know of, and personally I think it's a terrible idea, Ok, you might be right, but I'm curious why you think it's so terrible though. Is it becasue GCC hardly can be considered a "safe" compiler by the standardisation organisations due to the nature of the development process, which

MISRA C support for GCC?

2005-11-21 Thread Fredrik Hederstierna
Hi Do anyone know if there exist any project to get GCC support checking of MISRA C rules? Otherwise, do anyone think this is a good idea? BR, Fredrik