From 210ca97cb9ac50dc57a2b8c18130ab0ba45fbe8f Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Wed, 14 Apr 2021 17:55:48 +0200 Subject: [PATCH] [tests] test handling of attribute on an array type. --- tests/syntax/array_formals.i | 9 +++++++++ tests/syntax/oracle/array_formals.res.oracle | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/tests/syntax/array_formals.i b/tests/syntax/array_formals.i index b9ad0f36783..78d48f301cb 100644 --- a/tests/syntax/array_formals.i +++ b/tests/syntax/array_formals.i @@ -3,3 +3,12 @@ int f(int a[2]) { return a[1]; } int g(int a[static 2]) { return a[1]; } int h(int a[static restrict const 2]) { return a[1]; } + +typedef int (__attribute__((test)) arr)[2]; + +int k(arr a) { return a[1]; } + +int l() { + arr a = { 0 }; + return k(a); +} diff --git a/tests/syntax/oracle/array_formals.res.oracle b/tests/syntax/oracle/array_formals.res.oracle index 2adb9651646..50a68337f1d 100644 --- a/tests/syntax/oracle/array_formals.res.oracle +++ b/tests/syntax/oracle/array_formals.res.oracle @@ -1,5 +1,6 @@ [kernel] Parsing tests/syntax/array_formals.i (no preprocessing) /* Generated by Frama-C */ +typedef int ( __attribute__((__test__)) arr)[2]; int f(int a[2]) { int __retres; @@ -21,4 +22,19 @@ int h(int a[static const restrict 2]) return __retres; } +int k(int ( __attribute__((__test__)) a)[2]) +{ + int __retres; + __retres = *(a + 1); + return __retres; +} + +int l(void) +{ + int tmp; + arr a = {0}; + tmp = k(a); + return tmp; +} + -- GitLab