aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorno-author <no-author@gcc.gnu.org>2004-03-04 15:40:55 +0000
committerno-author <no-author@gcc.gnu.org>2004-03-04 15:40:55 +0000
commit894ec90c94af3ae76aa59118c73ef024bd067853 (patch)
treed26fd24c26041ba2545cca75dbe38a34280de756 /gcc/testsuite
parent517c4ea920bed34700fb385d45e7ce0f6bd665f6 (diff)
This commit was manufactured by cvs2svn to create branch
'tree-ssa-20020619-branch'. git-svn-id: https://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@78913 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/g++.dg/other/profile1.C51
-rw-r--r--gcc/testsuite/gcc.c-torture/compile/20040304-1.c45
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/20040302-1.c24
-rw-r--r--gcc/testsuite/gcc.dg/decl-4.c10
-rw-r--r--gcc/testsuite/gcc.dg/framework-1.c4
-rw-r--r--gcc/testsuite/gcc.dg/i386-asm-2.c61
6 files changed, 195 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/other/profile1.C b/gcc/testsuite/g++.dg/other/profile1.C
new file mode 100644
index 00000000000..bc92460830b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/other/profile1.C
@@ -0,0 +1,51 @@
+// PR 11767
+// { dg-do run }
+// { dg-options "-fnon-call-exceptions -fprofile-arcs" }
+
+#include <string>
+
+typedef unsigned long ACE_UINT32;
+extern "C" void abort();
+
+static ACE_UINT32 const msc_maxCurrencyID = 9999;
+
+class ResourceBalanceType2
+{
+ public:
+ explicit ResourceBalanceType2(
+ ACE_UINT32 resourceBalanceTypeID,
+ ACE_UINT32 isoValue,
+ const std::string& rc_shortName,
+ const std::string& rc_symbol
+ );
+ public:
+ const ACE_UINT32 mc_resBalTypeID;
+ const ACE_UINT32 mc_isoValue;
+ const std::string mc_shortName;
+ const std::string mc_symbol;
+};
+
+void f(){}
+
+ResourceBalanceType2::ResourceBalanceType2(
+ ACE_UINT32 resourceBalanceTypeID,
+ ACE_UINT32 isoValue,
+ const std::string& rc_shortName,
+ const std::string& rc_symbol)
+ : mc_resBalTypeID(resourceBalanceTypeID),
+ mc_isoValue(isoValue),
+ mc_shortName(rc_shortName),
+ mc_symbol(rc_symbol)
+{
+ bool isGreater = (mc_isoValue > msc_maxCurrencyID);
+ f();
+ bool temp = mc_isoValue > msc_maxCurrencyID;
+ if (!isGreater) abort();
+ if (!temp) abort();
+}
+
+int main (int argc, char * argv[])
+{
+ ACE_UINT32 const mc_isoValue = 10000;
+ ResourceBalanceType2 rbResourceBalanceType2(3, mc_isoValue, "ATM", "M");
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/20040304-1.c b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c
new file mode 100644
index 00000000000..146d42f23d6
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/compile/20040304-1.c
@@ -0,0 +1,45 @@
+/* PR optimization/14235 */
+/* Origin: <senor_fjord@yahoo.com> */
+
+typedef signed char int8_t;
+typedef short int16_t;
+typedef int int32_t;
+typedef unsigned long long uint64_t;
+
+static const uint64_t LOW_BYTE_MASK = 0x00000000000000ffULL;
+static const uint64_t HIGH_BYTE_MASK = 0x000000000000ff00ULL;
+static const uint64_t WORD_MASK = 0x000000000000ffffULL;
+static const uint64_t DWORD_MASK = 0x00000000ffffffffULL;
+
+extern uint64_t *srca_mask;
+extern int *assert_thrown;
+
+void foo()
+{
+ uint64_t tempA = 0; /* actually a bunch of code to set A */
+ uint64_t tempB = 0; /* actually a bunch of code to set B */
+
+ /* cast A to right size */
+ tempA = (((*srca_mask == LOW_BYTE_MASK) ||
+ (*srca_mask == HIGH_BYTE_MASK)) ?
+ ((int8_t)tempA) :
+ ((*srca_mask == WORD_MASK) ?
+ ((int16_t)tempA) :
+ ((*srca_mask == DWORD_MASK) ?
+ ((int32_t)tempA) :
+ tempA)));
+
+ /* cast B to right size */
+ tempB = (((*srca_mask == LOW_BYTE_MASK) ||
+ (*srca_mask == HIGH_BYTE_MASK)) ?
+ ((int8_t)tempB) :
+ ((*srca_mask == WORD_MASK) ?
+ ((int16_t)tempB) :
+ ((*srca_mask == DWORD_MASK) ?
+ ((int32_t)tempB) :
+ tempB)));
+
+ if ((int) tempA > (int) tempB) {
+ *assert_thrown = 1;
+ }
+}
diff --git a/gcc/testsuite/gcc.c-torture/execute/20040302-1.c b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c
new file mode 100644
index 00000000000..07056c43f4e
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/20040302-1.c
@@ -0,0 +1,24 @@
+int code[]={0,0,0,0,1};
+
+void foo(int x) {
+ volatile int b;
+ b = 0xffffffff;
+}
+
+void bar(int *pc) {
+ static const void *l[] = {&&lab0, &&end};
+
+ foo(0);
+ goto *l[*pc];
+ lab0:
+ foo(0);
+ pc++;
+ goto *l[*pc];
+ end:
+ return;
+}
+
+int main() {
+ bar(code);
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/decl-4.c b/gcc/testsuite/gcc.dg/decl-4.c
new file mode 100644
index 00000000000..acc7e77e2ea
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/decl-4.c
@@ -0,0 +1,10 @@
+/* Redeclaration of parameters is an error. PR 13728. */
+/* { dg-do compile } */
+
+void f (int fred, /* { dg-error "previous definition" "" } */
+ int fred); /* { dg-error "redefinition of parameter" "" } */
+
+void f2 (int fred, /* { dg-error "previous definition" "" } */
+ int fred) /* { dg-error "redefinition of parameter" "" } */
+{
+}
diff --git a/gcc/testsuite/gcc.dg/framework-1.c b/gcc/testsuite/gcc.dg/framework-1.c
new file mode 100644
index 00000000000..7e686832994
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/framework-1.c
@@ -0,0 +1,4 @@
+/* { dg-do compile { target *-*-darwin* } } */
+/* { dg-options "-F." } */
+
+#include <Carbon/Carbon.h>
diff --git a/gcc/testsuite/gcc.dg/i386-asm-2.c b/gcc/testsuite/gcc.dg/i386-asm-2.c
new file mode 100644
index 00000000000..e143ea36978
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/i386-asm-2.c
@@ -0,0 +1,61 @@
+/* PR opt/13862 */
+/* { dg-do compile { target i?86-*-* } } */
+/* { dg-options "-O" } */
+
+typedef struct _fame_syntax_t_ {
+} fame_syntax_t;
+
+typedef struct _fame_bitbuffer_t_
+{
+ unsigned char * base;
+ unsigned char * data;
+ unsigned long shift;
+} fame_bitbuffer_t;
+
+#define fast_bitbuffer_write(data, shift, c, l) \
+{ \
+ int d; \
+ \
+ asm("add %1, %%ecx\n" /* ecx = shift + length */ \
+ "shrd %%cl, %2, %3\n" /* adjust code to fit in */ \
+ "shr %%cl, %2\n" /* adjust code to fit in */ \
+ "mov %%ecx, %1\n" /* shift += length */ \
+ "bswap %2\n" /* reverse byte order of code */ \
+ "shr $5, %%ecx\n" /* get dword increment */ \
+ "or %2, (%0)\n" /* put first 32 bits */ \
+ "bswap %3\n" /* reverse byte order of code */ \
+ "lea (%0, %%ecx, 4), %0\n" /* data += (ecx>32) */ \
+ "andl $31, %1\n" /* mask shift */ \
+ "orl %3, (%0)\n" /* put last 32 bits */ \
+ : "=r"(data), "=r"(shift), "=a"(d), "=d"(d), "=c"(d) \
+ : "0"(data), "1"(shift), "2"((unsigned long) c), "3"(0), \
+ "c"((unsigned long) l) \
+ : "memory"); \
+}
+
+#define bitbuffer_write(bb, c, l) \
+ fast_bitbuffer_write((bb)->data, (bb)->shift, c, l)
+
+typedef enum { frame_type_I, frame_type_P } frame_type_t;
+
+typedef struct _fame_syntax_mpeg1_t_ {
+ fame_bitbuffer_t buffer;
+ frame_type_t frame_type;
+} fame_syntax_mpeg1_t;
+
+#define FAME_SYNTAX_MPEG1(x) ((fame_syntax_mpeg1_t *) x)
+
+void mpeg1_start_picture(fame_syntax_t *syntax)
+{
+ fame_syntax_mpeg1_t *syntax_mpeg1 = FAME_SYNTAX_MPEG1(syntax);
+ bitbuffer_write(&syntax_mpeg1->buffer, 0xFFFF, 16);
+
+ switch(syntax_mpeg1->frame_type) {
+ case frame_type_I:
+ bitbuffer_write(&syntax_mpeg1->buffer, 0, 1);
+ break;
+ case frame_type_P:
+ bitbuffer_write(&syntax_mpeg1->buffer, 0, 1);
+ break;
+ }
+}