[Bug c++/71011] Wrong "may be uninitialized" warning

2016-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71011

Pranith Kumar  changed:

   What|Removed |Added

 CC||bobby.prani at gmail dot com

--- Comment #1 from Pranith Kumar  ---
Created attachment 38443
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38443&action=edit
original source

[Bug c++/71011] New: Wrong "may be uninitialized" warning

2016-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71011

Bug ID: 71011
   Summary: Wrong "may be uninitialized" warning
   Product: gcc
   Version: 6.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com
  Target Milestone: ---

I am getting a warning that "data" may be uninitialized. But there is no such
variable being used anywhere.

src/allocate.cc: In member function ‘void allocate_c::run_a_cycle()’:
src/allocate.cc:136:19: error: ‘data’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
 else if (uop->m_uop_type == UOP_IADD || // integer register
  ~^~
cc1plus: all warnings being treated as errors

Please find attached the source along with pre-processed file. Tested with g++
4.7 and up and it is the same in all versions.

[Bug c++/71011] Wrong "may be uninitialized" warning

2016-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71011

--- Comment #2 from Pranith Kumar  ---
Created attachment 38444
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38444&action=edit
pre-procssed source

[Bug c++/71011] Wrong "may be uninitialized" warning

2016-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71011

--- Comment #3 from Pranith Kumar  ---
Command which shows this error:

$ g++ -o .opt_build/src/allocate.o -c -O3 -std=c++11 -funroll-loops -Werror
-Wuninitialized -Wno-write-strings -DLONG_COUNTERS -DNO_MPI -DNO_DEBUG
src/allocate.i -Wall -Wextra

[Bug c/79049] New: Unknown escape sequence not correctly pointed out

2017-01-10 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79049

Bug ID: 79049
   Summary: Unknown escape sequence not correctly pointed out
   Product: gcc
   Version: 6.2.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com
  Target Milestone: ---

GCC does not correctly point out the unknown escape sequence in the string
being printed.

#include 

int main()
{
  fprintf(stderr, "This statement has a \
   backslash\ which is not correctly pointed out by gcc\n");

  return 0;
}

Output from GCC:

$ gcc test.c -o test
test.c: In function ‘main’:
test.c:5:19: warning: unknown escape sequence: '\040'
   fprintf(stderr, "This statement has a \
   ^~~  

Output from Clang:

$ clang test.c -o test
test.c:6:29: warning: unknown escape sequence '\ ' [-Wunknown-escape-sequence]
   backslash\ which is not correctly pointed out by gcc\n");
^~

[Bug c/66083] New: Linux kernel fails to boot with O3 optimization

2015-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66083

Bug ID: 66083
   Summary: Linux kernel fails to boot with O3 optimization
   Product: gcc
   Version: 4.9.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com
  Target Milestone: ---

Created attachment 35507
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35507&action=edit
Enable O3 optimization

Linux kernel 4.1-rc1 fails to boot with O3 optimization. Patch to enable O3 and
config file attached.


[Bug c/66083] Linux kernel fails to boot with O3 optimization

2015-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66083

--- Comment #1 from Pranith Kumar  ---
Created attachment 35508
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35508&action=edit
config file


[Bug c/66083] Linux kernel fails to boot with O3 optimization

2015-05-08 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66083

--- Comment #3 from Pranith Kumar  ---
The kernel fails to boot. It works using 4.7/4.8 but 4.9 does not work. Not
sure what you mean which file. How do I pin point that?


[Bug rtl-optimization/63375] [4.8/4.9/5 Regression] reordering of reads across fences

2014-11-10 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63375

--- Comment #11 from Pranith Kumar  ---
Is there any work around for this in the mean time? Thanks!


[Bug rtl-optimization/63375] [4.8/4.9/5 Regression] reordering of reads across fences

2014-11-24 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63375

--- Comment #13 from Pranith Kumar  ---
The main concern here is moving the read past the fence instruction
irrespective of volatile semantics. The fence instruction guarantees that
accesses before the fence will complete before the accesses coming after the
fence. Consider the following case:

#include

typedef struct {
int counter;
} atomic_t;

static inline int atomic_read(atomic_t *v)
{
return (*(volatile int *)&(v)->counter);
}

static inline void atomic_write(atomic_t *v, int val)
{
v->counter = val;
}

#define smp_mb() asm volatile ("mfence":::"memory")

atomic_t val2 = {1};
int main()
{
atomic_t val1 = {1};
int p, q;

smp_mb();
p = atomic_read(&val1);
smp_mb();
atomic_write(&val2, 2);
smp_mb();
q = atomic_read(&val2);

printf("%d %d\n", p, q);

return 0;
}

Here, because of the bug the read from val1 is being generated after the write
to val2 breaking the semantics of memory fences. What am I missing?


[Bug rtl-optimization/63375] [4.8/4.9/5 Regression] reordering of reads across fences

2014-11-24 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63375

--- Comment #16 from Pranith Kumar  ---
This is not a good use case(it is a bit twisted, invalid too maybe?), but when
I try to read the stack without aliasing, the volatile write which I performed
is not visible.

#include 
#include 
#include 

typedef struct {
int counter;
} atomic_t;

static inline int atomic_read(atomic_t *v)
{
return (*(volatile int *)&(v)->counter);
}

static inline void atomic_write(atomic_t *v, int val)
{
v->counter = val;
}

#define smp_mb() asm volatile ("mfence":::"memory")

int i = 0;

int main(int argc, char *argv[])
{
atomic_t val1 = {2};
atomic_t val2 = {5};
int p = 0;

printf("%p %p\n", &val1, &val2); // try commenting this
smp_mb();
p = atomic_read(&val1);
smp_mb();
atomic_write(&val2, 9);
smp_mb();

printf("%d\n", *(int *)(&val1+4));

return 0;
}

In the above program, if I comment the first printf() there is no alias for
val2 and the atomic_write() is optimized out and I see 0 printed out in the
second printf(). But without commenting the first printf() the write is issued
because of which I see 9 printed in the second printf.


[Bug rtl-optimization/63375] New: reordering of reads across fences

2014-09-25 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63375

Bug ID: 63375
   Summary: reordering of reads across fences
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: rtl-optimization
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com

A read within the region of code enclosed by barriers is being moved out of the
regions. Test case follows:

#include

typedef struct {
int counter;
} atomic_t;

static inline int atomic_read(atomic_t *v)
{
return (*(volatile int *)&(v)->counter);
}

#define smp_mb() asm volatile ("mfence":::"memory")

int main()
{
atomic_t val = {1};
int p;

smp_mb();
p = atomic_read(&val);
smp_mb();

printf("%d\n", p);

return 0;
}

Generated assembly:

  15:mfence
  18:mfence
  1b:mov$0x1,%esi
  20:mov$0x0,%rdi
  27:xor%eax,%eax
  29:callq  2e 


[Bug rtl-optimization/63375] reordering of reads across fences

2014-09-25 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63375

Pranith Kumar  changed:

   What|Removed |Added

 CC||bobby.prani at gmail dot com

--- Comment #1 from Pranith Kumar  ---
Created attachment 33576
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33576&action=edit
test case

$ gcc -S -O2 test.c


[Bug c++/63444] New: Compilation consumes 2.5G memory

2014-10-02 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63444

Bug ID: 63444
   Summary: Compilation consumes 2.5G memory
   Product: gcc
   Version: 4.9.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com

Created attachment 33641
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33641&action=edit
pre-processed file

The compilation of the attached pre-processed file takes 2.5G memory. Not
exactly a regression since both 4.8 and 4.9 do the same. But may be an
interesting test case for optimizations.

$ g++ -std=c++11 -c  -fPIC -DNDEBUG -O3 -fno-strict-aliasing  -D_REENTRANT
-D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 test.i -o test.o


[Bug c++/63444] Compilation consumes 2.5G memory

2014-10-02 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63444

--- Comment #1 from Pranith Kumar  ---
Just FYI, clang compiles the same file using 1G memory.


[Bug c++/68821] New: g++ does not warn/error when virtual function return type is different than the one it overrides

2015-12-09 Thread bobby.prani at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=68821

Bug ID: 68821
   Summary: g++ does not warn/error when virtual function return
type is different than the one it overrides
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: bobby.prani at gmail dot com
  Target Milestone: ---

Consider:

typedef void (*obj_t)(void);

class parent {
  public:

struct obj_base {
  virtual ~obj_base() {}
  virtual void operator()(void)=0;
};

template  struct obj : public obj_base {
  typedef void (T::*obj_t)(void);
  T* p; obj_t f;
  obj(T* p, obj_t f) : p(p), f(f) {}
  int *operator()(void) {
return 0;
  }
};
};

The overridden function has a different return type in the two cases. g++ does
not warn/error out about this.