[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
Wed Feb 15 05:44:45 PST 2017


rogfer01 created this revision.

This patch fixes an assertion that is hit when a redeclaration with differing types only differs in the unaligned type-qualifier.


https://reviews.llvm.org/D29986

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


Index: test/Sema/unaligned-qualifier.c
===================================================================
--- /dev/null
+++ 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: lib/AST/ASTContext.cpp
===================================================================
--- lib/AST/ASTContext.cpp
+++ 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.88514.patch
Type: text/x-patch
Size: 1021 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170215/c40d31be/attachment.bin>


More information about the cfe-commits mailing list