Could preprocessor warn for unsafe macros and side-effects?

2017-07-11 Thread sa...@hederstierna.com
Hi Reading about macro pitfalls and eg duplication side-effects https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html#Macro-Pitfalls would it be possible to let the preprocessor generate warnings for any of these pitfalls? Maybe all language specific parts are not know at this early preprocess

Re: Question about "instruction merge" pass when optimizing for size

2015-08-20 Thread sa...@hederstierna.com
> > From: Jeff Law > More important is to determine *why* we're getting these patterns. In > the IRA/LRA world, they should be a lot less common. Yes I agree this phenomena seems more common after introducing LRA. Though I was thinking that such a pass

Question about "instruction merge" pass when optimizing for size

2015-08-19 Thread sa...@hederstierna.com
When compiling ARM/thumb with -Os for size, I've seen some cases where GCC generates unnecessary move instructions. It seems sometimes that there are some possibility to improve the use from 2-operand into 3-operand instructions. Some patterns I see is: Generated code Case 1:

RE: About loop unrolling and optimize for size

2015-08-14 Thread sa...@hederstierna.com
sibly debugging harder? Thanks/Fredrik From: Richard Biener [richard.guent...@gmail.com] Sent: Friday, August 14, 2015 09:28 To: sa...@hederstierna.com Cc: gcc@gcc.gnu.org Subject: Re: About loop unrolling and optimize for size On Thu, Aug 13, 2015

About loop unrolling and optimize for size

2015-08-13 Thread sa...@hederstierna.com
Hi I'm using an ARM thumb cross compiler for embedded systems and always do optimize for small size with -Os. Though I've experimented with optimization flags, and loop unrolling. Normally loop unrolling is always bad for size, code is duplicated and size increases. Though I discovered that in

Possible typo in LRA

2015-02-05 Thread sa...@hederstierna.com
Hi When reviewing some code from LRA, I just saw some lines that looked a bit strange, could it be a possible typo perhaps? The file "lra.c" from GC5 master branch current date Line 469: /* Try x = index_scale; x = x + disp; x = x + base. */ last = get_last_insn ()

Warn if making external references to local stack memory?

2012-04-08 Thread sa...@hederstierna.com
Hi 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. I think all ca

Static code analysis follow ups

2011-12-30 Thread sa...@hederstierna.com
Hi! I'm currently looking into possibilities to improve GCC for static-code-analysis features. Some weeks ago I proposed re-introducing -Wunreachable-code for finding dead code: http://gcc.gnu.org/ml/gcc-patches/2011-12/msg00385.html (The warning was removed in http://gcc.gnu.org/ml/gcc-pat

RE: Question about static code analysis features in GCC

2011-04-12 Thread sa...@hederstierna.com
milar? Thanks and Best Regards /Fredrik From: Richard Guenther [richard.guent...@gmail.com] Sent: Wednesday, February 16, 2011 11:17 To: sa...@hederstierna.com Cc: gcc@gcc.gnu.org Subject: Re: Question about static code analysis features in GCC On Wed, Feb 16, 2011 at 8:54 AM, sa...@

RE: Question about static code analysis features in GCC

2011-02-16 Thread sa...@hederstierna.com
r [richard.guent...@gmail.com] Sent: Sunday, February 13, 2011 10:54 To: sa...@hederstierna.com Cc: gcc@gcc.gnu.org Subject: Re: Question about static code analysis features in GCC On Sun, Feb 13, 2011 at 2:34 AM, sa...@hederstierna.com wrote: > Hi > > I would like to have some advice regardin

Question about static code analysis features in GCC

2011-02-12 Thread sa...@hederstierna.com
Hi I would like to have some advice regarding static code analysis and GCC. I've just reviewed several tools like Klocwork, Coverity, CodeSonar and PolySpace. These tools offer alot of features and all tools seems to find different types of defects. The tool that found most bugs on our code was