aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-07-29 11:28:57 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-07-29 11:28:57 +0000
commit78169471c981edf3a7e01ff3853ccb42d85c03fb (patch)
tree5eadb0c097cdb15ab59963a480b740ae2e06ef65 /gcc
parentbb3aa3f830e10a2e73af21c9d67ebef56451d5d4 (diff)
downloadgcc-78169471c981edf3a7e01ff3853ccb42d85c03fb.zip
gcc-78169471c981edf3a7e01ff3853ccb42d85c03fb.tar.gz
gcc-78169471c981edf3a7e01ff3853ccb42d85c03fb.tar.bz2
re PR c/71574 (ICE on code with alloc_align attribute on x86_64-linux-gnu: in default_conversion, at c/c-typeck.c:2126)
PR c/71574 * c-common.c (handle_alloc_align_attribute): Also check FUNCTION_DECL. * c-c++-common/pr71574.c: New test. From-SVN: r238859
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-family/ChangeLog5
-rw-r--r--gcc/c-family/c-common.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/c-c++-common/pr71574.c12
4 files changed, 24 insertions, 1 deletions
diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index 1007340..705d00c 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-29 Marek Polacek <polacek@redhat.com>
+
+ PR c/71574
+ * c-common.c (handle_alloc_align_attribute): Also check FUNCTION_DECL.
+
2016-07-28 Martin Liska <mliska@suse.cz>
PR gcov-profile/68025
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 16e3965..efd9815 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -8370,7 +8370,8 @@ handle_alloc_align_attribute (tree *node, tree, tree args, int,
{
unsigned arg_count = type_num_arguments (*node);
tree position = TREE_VALUE (args);
- if (position && TREE_CODE (position) != IDENTIFIER_NODE)
+ if (position && TREE_CODE (position) != IDENTIFIER_NODE
+ && TREE_CODE (position) != FUNCTION_DECL)
position = default_conversion (position);
if (!tree_fits_uhwi_p (position)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index ebb2c2f..9960fb0 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-07-29 Marek Polacek <polacek@redhat.com>
+
+ PR c/71574
+ * c-c++-common/pr71574.c: New test.
+
2016-07-29 Kugan Vivekanandarajah <kuganv@linaro.org>
PR middle-end/68217
diff --git a/gcc/testsuite/c-c++-common/pr71574.c b/gcc/testsuite/c-c++-common/pr71574.c
new file mode 100644
index 0000000..320ae38
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/pr71574.c
@@ -0,0 +1,12 @@
+/* PR c/71574 */
+/* { dg-do compile } */
+
+int fn1 (void);
+int fn2 (void) __attribute__ ((alloc_align (fn1))); /* { dg-warning "parameter outside range" } */
+int fn3 (void) __attribute__ ((alloc_size (fn1))); /* { dg-warning "parameter outside range" } */
+int fn4 (void) __attribute__ ((assume_aligned (fn1))); /* { dg-warning "not integer constant" } */
+int fn5 (char *, char *) __attribute__((nonnull (fn1))); /* { dg-error "nonnull argument has invalid operand" } */
+int fn6 (const char *, ...) __attribute__ ((sentinel (fn1))); /* { dg-warning "not an integer constant" } */
+
+typedef int __attribute__((vector_size (fn1))) v4si; /* { dg-warning "attribute ignored" } */
+typedef int T __attribute__((aligned (fn1))); /* { dg-error "requested alignment is not" } */