[cfe-dev] Wrong condition for MS ABI in RecordLayoutBuilder.cpp

r4start r4start at gmail.com
Tue Dec 13 04:28:28 PST 2011


Hi all!

Today I found that condition in RecordLayoutBuilder::Layout(line 1382) 
is wrong.
For example
class first {
public:
   virtual void b() {}
   double b_field;
protected:
private:
};

class third: virtual first {
public:
   //virtual void a(){}
   double r;
};
In this case, condition "NonVirtualSize != 
NonVirtualSize.RoundUpToAlignment(Alignment)" will be wrong and we will 
enter in LayoutVirtualBases.
But we need MSLayoutVirtualBases.
This example very simple and LayoutVirtualBases works fine, but this 
mistake can provide some problems in the future.
I suggest revert this condition to old version with 2 "if".
if (isMicrosoftCXXABI())
   if (NonVirtualSize != NonVirtualSize.RoundUpToAlignment(Alignment))

I include patch that resolves this problem.

  - Dmitry.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: RecordLayoutBuilder.cpp.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20111213/4cb53a1d/attachment.ksh>


More information about the cfe-dev mailing list