[Bug c++/61501] New: spurious conversion warning with -Wconversion when calling isnan(double x)

2014-06-13 Thread niemayer at isg dot de
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61501

Bug ID: 61501
   Summary: spurious conversion warning with -Wconversion when
calling isnan(double x)
   Product: gcc
   Version: 4.9.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: niemayer at isg dot de

When compiling:
--
#include math.h

int test(double x) {
return isnan(x);
}
--

with
 gcc-4.9.0 -Wconversion -c /tmp/conversion_warn.cxx
a spurious warning is emitted:

/tmp/conversion_warn.cxx: In function 'int test(double)':
/tmp/conversion_warn.cxx:4:9: warning: conversion to 'float' from 'double' may
alter its value [-Wfloat-conversion]
  return isnan(x);
 ^

This is what the output of compiling with -E of the above sample looks (with
includes from glibc 2.5.1):

-
int test(double x) {
 return (sizeof (x) == sizeof (float) ? __isnanf (x) : sizeof (x) == sizeof
(double) ? __isnan (x) : __isnanl (x));
}
-

(This looks a little like Bug 51294, but that was reported fixed a long time
ago.)


[Bug c++/47987] New: ICE on legal code (when attempting to inline non-implicitly instantiated template member function)

2011-03-04 Thread niemayer at isg dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47987

   Summary: ICE on legal code (when attempting to inline
non-implicitly instantiated template member function)
   Product: gcc
   Version: 4.5.2
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: niema...@isg.de


Created attachment 23540
  -- http://gcc.gnu.org/bugzilla/attachment.cgi?id=23540
preprocessed and gzipped legal C++ code causing ICE with gcc 4.5.[0-2]

When compiling the attached crash.ii file using gcc 4.5.[012] with

 gcc -O3 -fno-implicit-templates -c crash.ii -o crash.o

gcc crashes with a segmentation fault:

 crashtest.cxx: In static member function 'static bool 
 LKV::MatchEntity::init_text_2_3(const LKV::Str, LKV::Str, LKV::Str, 
 LKV::Arraylong unsigned int, true, LKV::_TLKV::AbsPtr, long unsigned 
 int*, LKV::Arraylong unsigned int, true, LKV::_TLKV::AbsPtr, long 
 unsigned int*)':
crashtest.cxx:130:3:
 internal compiler error: Segmentation fault
 Please submit a full bug report,
 with preprocessed source if appropriate.
 See http://gcc.gnu.org/bugs.html for instructions.


The same code is compiled fine by gcc 4.4.*, it also compiles fine with
-O[0-2].

Notice that this code is part of a library that uses explicit template
instantiations, intriguingly when compiling with -fimplicit-templates, gcc
4.5.* does not crash - which let's me wonder how just doing less can actually
trigger such a bug :-)


[Bug c++/47987] ICE on legal code (when attempting to inline non-implicitly instantiated template member function)

2011-03-04 Thread niemayer at isg dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47987

--- Comment #1 from niemayer at isg dot de 2011-03-04 11:43:25 UTC ---
The line that gcc reports to cause the ICE contains:

 if (offset_a2-preallocate(text_1.length())) {

offset_a2 is an instance of class Arrayunsigned long, true, _TAbsPtr,
unsigned long - if that class is declared to be an extern template by

 extern template class Arrayunsigned long, true, _TAbsPtr, unsigned long;

before the function that causes the ICE, compilation works fine as well as it
does with implicit template instantiation. (All class names within namespace
LKV).


[Bug c++/35593] New: spurious warning array subscript is below array bounds with void* function argument plus -O2

2008-03-14 Thread niemayer at isg dot de
When compiling the following tiny example .cxx source with -Wall -O2, I get
spurious warnings:

- cut example test.cxx here --
extern void function(void * x);

struct A {
long x;
char d[0];
};


void test(A * a) {
function((char *)a - 4); // gcc emits warning, here - why?
}

// 

struct B {
char d[0];
};

void test(B * b) {
char * c = (char *)b;
void * v = c-1;
function(v);  // gcc emits warning, here - why?
}
- cut here --

The output of
 gcc -Wall -c test.cxx -O2
is:
/tmp/test.cxx: In function #8216;void test(B*)#8217;:
/tmp/test.cxx:22: warning: array subscript is below array bounds
/tmp/test.cxx: In function #8216;void test(A*)#8217;:
/tmp/test.cxx:10: warning: array subscript is below array bounds

I have not found a sane way in my non-example, real-world code to avoid those
warnings.


-- 
   Summary: spurious warning array subscript is below array bounds
with void* function argument plus -O2
   Product: gcc
   Version: 4.3.0
Status: UNCONFIRMED
  Severity: minor
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: niemayer at isg dot de
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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



[Bug c/12245] [4.0/4.1/4.2/4.3 regression] Uses lots of memory when compiling large initialized arrays

2008-01-17 Thread niemayer at isg dot de


--- Comment #34 from niemayer at isg dot de  2008-01-17 17:02 ---
Can you suggest any kind of work-around? Any alternative to represent constant
arrays in C/C++?

The problem with leaving this bug open indefinitely is that there are existing
programs (as the Unicode-test-case I mentioned above) which will simply not
compile on any reasonably equipped machine anymore.

I wouldn't mind to change the source code to represent the constant arrays in a
different way, but I have not found a method yet (other than using platform
dependend methods like generating assembler source).


-- 


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



[Bug c++/33911] attribute deprecated vs. templates

2007-12-20 Thread niemayer at isg dot de


--- Comment #2 from niemayer at isg dot de  2007-12-20 14:32 ---
I can second that problem for template member functions - in contrast to
non-template member functions, where the attribute works.

This gives a warning about deprecation as expected:
-
struct T { } ;

struct A {
inline void foo(T  ) __attribute__((deprecated));
};

inline void A::foo(T  ) { }

void test(T  t) {
A a;
a.foo(t);
}
-

... while this is not causing a warning as it should:
-
struct A {
template class T inline void foo(T  ) __attribute__((deprecated));
};

template class T inline void A::foo(T  ) { }

void test(A  t) {
A a;
a.foo(t);
}
-


-- 

niemayer at isg dot de changed:

   What|Removed |Added

 CC||niemayer at isg dot de


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



[Bug c/12245] [4.0/4.1/4.2/4.3 regression] Uses lots of memory when compiling large initialized arrays

2007-05-15 Thread niemayer at isg dot de


--- Comment #29 from niemayer at isg dot de  2007-05-15 16:54 ---
That's sad - while memory gets cheaper, it has still not become cheap enough to
cope with that huge increase in memory usage imposed by gcc 4.2. Seems I have
to stick with 4.1 until that problem is fixed...


-- 


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



[Bug c/12245] [4.0/4.1/4.2/4.3 regression] Uses lots of memory when compiling large initialized arrays

2006-12-13 Thread niemayer at isg dot de


--- Comment #27 from niemayer at isg dot de  2006-12-13 11:37 ---
I would like to mention that this problem seems to have worsened a lot for the
current snapshots of gcc-4.2 (currently testing with 4.2.0 20061205
(prerelease)) when compiling with at least -O1 - maybe due to the static
constant elimination?.

I tried to compile a Unicode normalization test C++ source that took gcc about
300MB of RAM before to compile with -O1 - now with gcc 4.2 I cannot compile
this source anymore on a machine with 1 GB of physical + 1 GB of virtual RAM
before the kernel OOM killer is killing cc1plus.

If somebody would like the source of my test-case, I can supply it.


-- 


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