[Bug c/47644] New: [avr] Regression in choosing registers

2011-02-08 Thread Kip.Hicit at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47644

   Summary: [avr] Regression in choosing registers
   Product: gcc
   Version: 4.3.3
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: kip.hi...@gmail.com


Created attachment 23275
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23275
Test case in C

Consider the following snippet compiled with -O3:

int lsl_short(int f) {
return f << 1;
}

gcc 4.3.3 is copying the value from r25:r24 (first parameter) to r19:r18, then
moving back to r25:r24 (return value). Same for longs but with 4 registers.

Expected:
The lsl and rol should happen directly on r25:r24, just as they did in 4.2


[Bug c/47644] [avr] Optimisation regression in choosing registers

2011-02-08 Thread Kip.Hicit at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47644

--- Comment #1 from Ángel  2011-02-08 11:47:46 UTC 
---
Created attachment 23276
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23276
gcc 4.3.3 assembler


[Bug c/47644] [avr] Optimisation regression in choosing registers

2011-02-08 Thread Kip.Hicit at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47644

--- Comment #2 from Ángel  2011-02-08 11:48:37 UTC 
---
Created attachment 23277
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=23277
gcc 4.2 assembler


[Bug c/48801] New: uninitialized warning for variables used only in loop body and initialized in the first iteration

2011-04-28 Thread Kip.Hicit at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48801

   Summary: uninitialized warning for variables used only in loop
body and initialized in the first iteration
   Product: gcc
   Version: 4.6.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: kip.hi...@gmail.com


Consider the code:

int loop_cond, some_value;

void foo(int arg);
void f() {
 int load, variable;

 load = 1;
 while (loop_cond) {
   if (load) {
  variable = some_value;
  load = 0;
   }

   foo(variable);
 } 
}


gcc -Wall -O1 initialise-warn.c
initialise-warn.c: In function `f':
initialise-warn.c:5: warning: 'variable' might be used uninitialized in this
fun
ction

variable is only used inside the loop, and always set at the beginning of its
first iteration.
The warning is gone if using a conditional instead of a loop, so it seems that
it could easily detect that it is initialised in this case, too. Perhaps it was
optimizing the constant with an if, but the load variable is local and can only
be changed inside the function, so it has no extra restrictions.


The warning appears in gcc 4.5.2 and 4.6.0
The false positive was probably always misreported.