[cfe-dev] Fix for weird assignment bug on MSVC
Argiris Kirtzidis
akyrtzi at gmail.com
Sat Feb 23 15:51:04 PST 2008
Hi,
As the comments in the patch say:
- getFileInfo(FE).DirInfo = getFileInfo(CurFileEnt).DirInfo;
+
+ // Note: Don't use: getFileInfo(FE).DirInfo =
getFileInfo(CurFileEnt).DirInfo;
+ // MSVC, behind the scenes, does this:
+
+ // PerFileInfo &pf1 = getFileInfo(CurFileEnt);
+ // PerFileInfo &pf2 = getFileInfo(FE);
+ // pf2.DirInfo = pf1.DirInfo
+
+ // The problem is that if there's a resize() of the FileInfo
vector during
+ // the getFileInfo(FE) call, pf1 will point to invalid data.
+
+ // Make the assignment explicit
+ unsigned int tmp = getFileInfo(CurFileEnt).DirInfo;
+ getFileInfo(FE).DirInfo = tmp;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: assign-fix.patch
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080223/a935c69a/attachment.ksh>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: assign-fix.zip
Type: application/octet-stream
Size: 658 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080223/a935c69a/attachment.obj>
More information about the cfe-dev
mailing list