[Bug c/11751] wrong evaluation order of an expression

2007-08-10 Thread gjasny at web dot de


--- Comment #78 from gjasny at web dot de  2007-08-10 12:02 ---
*** Bug 33043 has been marked as a duplicate of this bug. ***


-- 

gjasny at web dot de changed:

   What|Removed |Added

 CC||gjasny at web dot de


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11751



[Bug c/33043] Miscompiled statement a[i] = (a[i]++) % x;

2007-08-10 Thread gjasny at web dot de


--- Comment #2 from gjasny at web dot de  2007-08-10 12:02 ---
I've found:
http://c-faq.com/expr/seqpoints.html

*** This bug has been marked as a duplicate of 11751 ***


-- 

gjasny at web dot de changed:

   What|Removed |Added

 Status|UNCONFIRMED |RESOLVED
 Resolution||DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33043



[Bug c/33043] Miscompiled statement a[i] = (a[i]++) % x;

2007-08-10 Thread gjasny at web dot de


--- Comment #1 from gjasny at web dot de  2007-08-10 10:51 ---
Created an attachment (id=14049)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14049&action=view)
Simple testcase


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33043



[Bug c/33043] New: Miscompiled statement a[i] = (a[i]++) % x;

2007-08-10 Thread gjasny at web dot de
When the following program is compiled with gcc the output of the array-value
is 1 2 3 4 5 6. Icc and cl produce the output 1 2 3 4 1 2. If the arrray is
susbtituted by a simple scalar, the gcc output is 1 2 3 4 1 2, too.

I don't know if the statement if even valid and behavior-defined C code. If
it's not, then gcc maybe should warn somehow.

Thanks,
 Gregor

PS: This hapens with gcc-snapshot 20070720-1, too.


-- 
   Summary: Miscompiled statement a[i] = (a[i]++) % x;
   Product: gcc
   Version: 4.1.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gjasny at web dot de
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33043



[Bug c/30343] New: False positive: allocating zero-element array

2007-01-01 Thread gjasny at web dot de
Hi,

The following code produces a false positive warning "allocating zero-element
array".

template  class Array
{
public:
  Array() {
if (size) {
  new T[size];
}
  }
};

void foo() {
  Array bar;
}

the new command is guarded by a if(size). So allocating a zero size array is
impossible. It would be really nice if gcc could check for this condition,
also.

Thanks,
Gregor


-- 
   Summary: False positive: allocating zero-element array
   Product: gcc
   Version: 4.2.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P3
 Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: gjasny at web dot de
 GCC build triplet: gcc version 4.2.0 20061217 (prerelease) (Debian 4.2-
20061217-1)
  GCC host triplet: i486-linux-gnu
GCC target triplet: i486-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30343