[Bug c/46517] New: Wrong result on left shift operator without optimization

2010-11-17 Thread lepinat at free dot fr
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46517

   Summary: Wrong result on left shift operator without
optimization
   Product: gcc
   Version: 4.4.4
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: lepi...@free.fr


The next samples compiled without opimisation give not the same result
in both case if it's use has constante the result is good
(the test is on intel platfom)

# gcc -o shift  shift.c
result:
constant val=0
variable val=1

# gcc -O2 -o shift  shift.c
result:
constant val=0
variable val=0


On the first case is not a shift but it's rotate

you can verify by changing the constant:
example SHIFT = 34 the the result is 

constant val=0
variable val=4


88888
#include stdio.h


#define SHIFT(4*8)



int main(int argc, char* argv[])

{

int val = SHIFT;



printf(constant val=%x\n, (1SHIFT));



printf(variable val=%x\n, (1val));

return 0;

}



88888


[Bug c++/29745] New: fold_offsetof_1

2006-11-06 Thread lepinat at free dot fr
hello, I ported an app on x86_64 and I isolate the class who's make a compiler
break down.

bug.C:47: internal compiler error: in fold_offsetof_1, at c-common.c:5998
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://gcc.gnu.org/bugs.html for instructions.

the command line is:
g++ -c  -I/usr/X11/include -o bug.o bug.C

g++ -v
Using built-in specs.
Target: x86_64-slackware-linux
Configured with: ../gcc-4.1.1/configure --prefix=/usr --enable-shared
--enable-threads=posix --enable-__cxa_atexit --disable-checking --with-gnu-ld
--verbose --target=x86_64-slackware-linux --host=x86_64-slackware-linux
Thread model: posix
gcc version 4.1.1

// 
// bug.h
// 

// g++ -c  -I/usr/X11/include -o bug.o bug.C

#ifndef _BUG_H_
#define _BUG_H_

#include X11/Intrinsic.h

typedef char * HelpNode;

class MLXHelp {
protected:

  static Pixel highlightPixel;

  static XtResource mlxHelpResources[];

  static Pixel htPixel;



public:  
   MLXHelp(char *filename = NULL, Widget parent = NULL, HelpNode *hn = NULL);
  virtual ~MLXHelp();

};
#endif 

// -- 
// bug.C  
// --

#include bug.h
#include X11/StringDefs.h


XtResource MLXHelp::mlxHelpResources [] = {
  {
hypertextColor, hypertextColor, XtRPixel, sizeof(Pixel),
XtOffsetOf(::MLXHelp, htPixel), XtRString, (XtPointer)steelblue4
  },
  {
charHighlightColor, charHighlightColor, XtRPixel, sizeof(Pixel),
XtOffsetOf(::MLXHelp, highlightPixel), XtRString, (XtPointer)red
  }
};

MLXHelp::MLXHelp(char *filename, Widget wg, HelpNode *hn)

}

MLXHelp::~MLXHelp()
{
}


-- 
   Summary: fold_offsetof_1
   Product: gcc
   Version: 4.1.1
Status: UNCONFIRMED
  Severity: critical
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: lepinat at free dot fr
  GCC host triplet: linux 2.6.18.1


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