[PATCH] D29986: Fix crash when an incorrect redeclaration only differs in __unaligned type-qualifier

Roger Ferrer Ibanez via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 24 00:52:58 PST 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL296099: Fix crash when an incorrect redeclaration only differs in __unaligned type… (authored by rogfer01).

Changed prior to commit:
  https://reviews.llvm.org/D29986?vs=88514&id=89617#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29986

Files:
  cfe/trunk/lib/AST/ASTContext.cpp
  cfe/trunk/test/Sema/unaligned-qualifier.c


Index: cfe/trunk/test/Sema/unaligned-qualifier.c
===================================================================
--- cfe/trunk/test/Sema/unaligned-qualifier.c
+++ cfe/trunk/test/Sema/unaligned-qualifier.c
@@ -0,0 +1,4 @@
+// RUN: %clang_cc1 %s -verify -fsyntax-only -fms-extensions
+
+int __unaligned * p1; // expected-note {{previous definition is here}}
+int * p1; // expected-error {{redefinition of 'p1' with a different type: 'int *' vs '__unaligned int *'}}
Index: cfe/trunk/lib/AST/ASTContext.cpp
===================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp
+++ cfe/trunk/lib/AST/ASTContext.cpp
@@ -8077,7 +8077,8 @@
     // mismatch.
     if (LQuals.getCVRQualifiers() != RQuals.getCVRQualifiers() ||
         LQuals.getAddressSpace() != RQuals.getAddressSpace() ||
-        LQuals.getObjCLifetime() != RQuals.getObjCLifetime())
+        LQuals.getObjCLifetime() != RQuals.getObjCLifetime() ||
+        LQuals.hasUnaligned() != RQuals.hasUnaligned())
       return QualType();
 
     // Exactly one GC qualifier difference is allowed: __strong is


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29986.89617.patch
Type: text/x-patch
Size: 1103 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170224/643ad263/attachment.bin>


More information about the cfe-commits mailing list