* scaffold/tinycc/: Remove.
* build-aux/check-mescc.sh: Remove tinycc testing.
* build-aux/check-tcc.sh: New file.
* build-aux/check.sh.in: Use it.
* build-aux/config.sh: Update.
* build-aux/export.make: Update.
fi
done
-tests="
-00_assignment
-01_comment
-02_printf
-03_struct
-04_for
-05_array
-06_case
-07_function
-08_while
-09_do_while
-
-10_pointer
-11_precedence
-12_hashdefine
-13_integer_literals
-14_if
-15_recursion
-16_nesting
-17_enum
-18_include
-19_pointer_arithmetic
-
-20_pointer_comparison
-21_char_array
-22_floating_point
-23_type_coercion
-24_math_library
-25_quicksort
-26_character_constants
-27_sizeof
-28_strings
-29_array_address
-
-30_hanoi
-31_args
-32_led
-33_ternary_op
-34_array_assignment
-35_sizeof
-36_array_initialisers
-37_sprintf
-38_multiple_array_index
-39_typedef
-
-40_stdio
-41_hashif
-42_function_pointer
-43_void_param
-44_scoped_declarations
-45_empty_for
-47_switch_return
-48_nested_break
-49_bracket_evaluation
-
-50_logical_second_arg
-51_static
-52_unnamed_enum
-54_goto
-55_lshift_type
-"
-
-broken="$broken
-18_include
-
-22_floating_point
-23_type_coercion
-24_math_library
-26_character_constants
-27_sizeof
-28_strings
-
-34_array_assignment
-39_typedef
-
-40_stdio
-42_function_pointer
-49_bracket_evaluation
-55_lshift_type
-"
-
-#22_floating_point ; float
-#23_type_coercion ; float
-#24_math_library ; float
-#27_sizeof ; float
-#28_strings ; TODO: strncpy strchr strrchr memset memcpy memcmp
-#30_hanoi ; fails with GCC
-#34_array_assignment ; fails with GCC
-#39_typedef ;unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
-
-#40_stdio ; f* functions
-#42_function_pointer ; f* functions
-#49_bracket_evaluation ; float
-
-
-LIBC=c+gnu
-MES_LIBS="-l c+gnu"
-
-expect=$(echo $broken | wc -w)
-ARGS="arg1 arg2 arg3 arg4 arg5"
-export ARGS
-mkdir -p scaffold/tinycc
-for t in $tests; do
- if [ ! -f scaffold/tinycc/"$t.c" ]; then
- echo ' [SKIP]'
- continue;
- fi
- sh ${srcdest}build-aux/test.sh "scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log
- r=$?
- total=$((total+1))
- if [ $r = 0 ]; then
- echo $t: [OK]
- pass=$((pass+1))
- else
- echo $t: [FAIL]
- fail=$((fail+1))
- fi
-done
[ $expect != 0 ] && echo "expect: $expect"
[ $fail != 0 ] && echo "failed: $fail"
[ $fail -lt $expect ] && echo "solved: $(($expect - $fail))"
--- /dev/null
+#! /bin/sh
+
+# GNU Mes --- Maxwell Equations of Software
+# Copyright © 2017,2018 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
+#
+# This file is part of GNU Mes.
+#
+# GNU Mes is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at
+# your option) any later version.
+#
+# GNU Mes is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Mes. If not, see <http://www.gnu.org/licenses/>.
+
+set -e
+. ${srcdest}build-aux/config.sh
+. ${srcdest}build-aux/trace.sh
+
+MES=${MES-src/mes}
+[ -z "$MESCC" ] && MESCC=scripts/mescc
+GUILE=${GUILE-guile}
+MES_PREFIX=${MES_PREFIX-mes}
+
+HEX2=${HEX2-hex2}
+M1=${M1-M1}
+BLOOD_ELF=${BLOOD_ELF-blood-elf}
+MES_SEED=${MES_SEED-../mes-seed}
+MESCC=${MESCC-$(command -v mescc)}
+[ -z "$MESCC" ] && MESCC=scripts/mescc
+MES=${MES-$(command -v mes)}
+[ -z "$MES" ] && MES=src/mes
+
+if ! command -v $GUILE > /dev/null; then
+ GUILE=true
+fi
+
+tests="
+00_assignment
+01_comment
+02_printf
+03_struct
+04_for
+05_array
+06_case
+07_function
+08_while
+09_do_while
+
+10_pointer
+11_precedence
+12_hashdefine
+13_integer_literals
+14_if
+15_recursion
+16_nesting
+17_enum
+18_include
+19_pointer_arithmetic
+
+20_pointer_comparison
+21_char_array
+22_floating_point
+23_type_coercion
+24_math_library
+25_quicksort
+26_character_constants
+27_sizeof
+28_strings
+29_array_address
+
+30_hanoi
+31_args
+32_led
+33_ternary_op
+34_array_assignment
+35_sizeof
+36_array_initialisers
+37_sprintf
+38_multiple_array_index
+39_typedef
+
+40_stdio
+41_hashif
+42_function_pointer
+43_void_param
+44_scoped_declarations
+45_empty_for
+47_switch_return
+48_nested_break
+49_bracket_evaluation
+
+50_logical_second_arg
+51_static
+52_unnamed_enum
+54_goto
+55_lshift_type
+"
+
+broken="$broken
+18_include
+
+22_floating_point
+23_type_coercion
+24_math_library
+26_character_constants
+27_sizeof
+28_strings
+
+34_array_assignment
+39_typedef
+
+40_stdio
+42_function_pointer
+49_bracket_evaluation
+55_lshift_type
+"
+
+#22_floating_point ; float
+#23_type_coercion ; float
+#24_math_library ; float
+#27_sizeof ; float
+#28_strings ; TODO: strncpy strchr strrchr memset memcpy memcmp
+#30_hanoi ; fails with GCC
+#34_array_assignment ; fails with GCC
+#39_typedef ;unsupported: (decl (decl-spec-list (stor-spec (typedef)) (type-spec (typename "MyFunStruct"))) (init-declr-list (init-declr (ptr-declr (pointer) (ident "MoreFunThanEver")))))
+
+#40_stdio ; f* functions
+#42_function_pointer ; f* functions
+#49_bracket_evaluation ; float
+
+
+LIBC=c+gnu
+MES_LIBS="-l c+gnu"
+
+expect=$(echo $broken | wc -w)
+ARGS="arg1 arg2 arg3 arg4 arg5"
+export ARGS
+mkdir -p scaffold/tinycc
+for t in $tests; do
+ if [ ! -f $TINYCC_PREFIX/"$t.c" ]; then
+ echo ' [SKIP]'
+ continue;
+ fi
+ cp $TINYCC_PREFIX/tests/tests2/$i* scaffold/tinycc
+ sh ${srcdest}build-aux/test.sh "scaffold/tinycc/$t" &> scaffold/tinycc/"$t".log
+ r=$?
+ total=$((total+1))
+ if [ $r = 0 ]; then
+ echo $t: [OK]
+ pass=$((pass+1))
+ else
+ echo $t: [FAIL]
+ fail=$((fail+1))
+ fi
+done
+[ $expect != 0 ] && echo "expect: $expect"
+[ $fail != 0 ] && echo "failed: $fail"
+[ $fail -lt $expect ] && echo "solved: $(($expect - $fail))"
+echo "passed: $pass"
+echo "total: $total"
+if [ $fail != 0 -a $fail -gt $expect ]; then
+ echo FAILED: $fail/$total
+ exit 1
+elif [ $fail != 0 ]; then
+ echo PASS: $pass/$total
+else
+ echo PASS: $total
+fi
GUILE=${GUILE-guile}
MES=${MES-src/mes}
MES_ARENA=${MES_ARENA-100000000}
+TCC_PREFIX=${TCC_PREFIX-${srcdest}../tinycc}
if ! command -v $GUILE > /dev/null; then
GUILE=true
[ "$MES" != guile ] && bash ${srcdest}build-aux/check-mes.sh
bash ${srcdest}build-aux/check-boot.sh
bash ${srcdest}build-aux/check-mescc.sh
+[ -d $TINYCC_PREFIX/tests/tests2 ] && bash ${srcdest}build-aux/check-tcc.sh
export MES_ARENA
export COMPILE
export PREPROCESS
+export TINYCC_PREFIX
export V
export abs_top_builddir
ifdef TINYCC_SEED
export TINYCC_SEED
endif
+
+ifdef TINYCC_PREFIX
+export TINYCC_PREFIX
+endif
MES_SEED location of mes-seed
MESCC_TOOLS_SEED location of mescc-tools-seed
TCC tcc C compiler command
+ TINYCC_PREFIX location of tinycc [for tests/test2]
TINYCC_SEED location of tinycc-seed
" PACKAGE VERSION (getenv "prefix")))
(for-each (lambda (v) (apply setenv (string-split v #\=))) vars)
(let* ((mes-seed (or (getenv "MES_SEED")
(string-append srcdest "../mes-seed")))
+ (tinycc-prefix (or (getenv "TINYCC_PREFIX")
+ (string-append srcdest "../tinycc-prefix")))
(tinycc-seed (or (getenv "TINYCC_SEED")
(string-append srcdest "../tinycc-seed")))
(mescc-tools-seed (or (getenv "MESCC_TOOLS_SEED")
(deps (cons (check-file (make-dep "mescc-tools-seed" '(0) #:optional? #t
#:file-name mescc-tools-seed))
deps))
+ (deps (cons (check-file (make-dep "tinycc-prefix" '(0) #:optional? #t
+ #:file-name tinycc-prefix))
+ deps))
(missing (filter (conjoin (negate dependency-file-name)
(negate dependency-optional?)) deps)))
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- a = 42;
- printf("%d\n", a);
-
- int b = 64;
- printf("%d\n", b);
-
- int c = 12, d = 34;
- printf("%d, %d\n", c, d);
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-42
-64
-12, 34
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- printf("Hello\n");
- printf("Hello\n"); /* this is a comment */ printf("Hello\n");
- printf("Hello\n");
- // this is also a comment sayhello();
- printf("Hello\n");
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-Hello
-Hello
-Hello
-Hello
-Hello
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- printf("Hello world\n");
-
- int Count;
- for (Count = -5; Count <= 5; Count++)
- printf("Count = %d\n", Count);
-
- printf("String 'hello', 'there' is '%s', '%s'\n", "hello", "there");
- printf("Character 'A' is '%c'\n", 65);
- printf("Character 'a' is '%c'\n", 'a');
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-Hello world
-Count = -5
-Count = -4
-Count = -3
-Count = -2
-Count = -1
-Count = 0
-Count = 1
-Count = 2
-Count = 3
-Count = 4
-Count = 5
-String 'hello', 'there' is 'hello', 'there'
-Character 'A' is 'A'
-Character 'a' is 'a'
+++ /dev/null
-#include <stdio.h>
-
-struct fred
-{
- int boris;
- int natasha;
-};
-
-int main()
-{
- struct fred bloggs;
-
- bloggs.boris = 12;
- bloggs.natasha = 34;
-
- printf("%d\n", bloggs.boris);
- printf("%d\n", bloggs.natasha);
-
- struct fred jones[2];
- jones[0].boris = 12;
- jones[0].natasha = 34;
- jones[1].boris = 56;
- jones[1].natasha = 78;
-
- printf("%d\n", jones[0].boris);
- printf("%d\n", jones[0].natasha);
- printf("%d\n", jones[1].boris);
- printf("%d\n", jones[1].natasha);
-
- return 0;
-}
+++ /dev/null
-12
-34
-12
-34
-56
-78
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count;
-
- for (Count = 1; Count <= 10; Count++)
- {
- printf("%d\n", Count);
- }
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count;
- int Array[10];
-
- for (Count = 1; Count <= 10; Count++)
- {
- Array[Count-1] = Count * Count;
- }
-
- for (Count = 0; Count < 10; Count++)
- {
- printf("%d\n", Array[Count]);
- }
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-1
-4
-9
-16
-25
-36
-49
-64
-81
-100
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count;
-
- for (Count = 0; Count < 4; Count++)
- {
- printf("%d\n", Count);
- switch (Count)
- {
- case 1:
- printf("%d\n", 1);
- break;
-
- case 2:
- printf("%d\n", 2);
- break;
-
- default:
- printf("%d\n", 0);
- break;
- }
- }
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-0
-0
-1
-1
-2
-2
-3
-0
+++ /dev/null
-#include <stdio.h>
-
-int myfunc(int x)
-{
- return x * x;
-}
-
-void vfunc(int a)
-{
- printf("a=%d\n", a);
-}
-
-void qfunc()
-{
- printf("qfunc()\n");
-}
-
-int main()
-{
- printf("%d\n", myfunc(3));
- printf("%d\n", myfunc(4));
-
- vfunc(1234);
-
- qfunc();
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-9
-16
-a=1234
-qfunc()
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- int p;
- int t;
-
- a = 1;
- p = 0;
- t = 0;
-
- while (a < 100)
- {
- printf("%d\n", a);
- t = a;
- a = t + p;
- p = t;
- }
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-1
-1
-2
-3
-5
-8
-13
-21
-34
-55
-89
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- int p;
- int t;
-
- a = 1;
- p = 0;
- t = 0;
-
- do
- {
- printf("%d\n", a);
- t = a;
- a = t + p;
- p = t;
- } while (a < 100);
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-1
-1
-2
-3
-5
-8
-13
-21
-34
-55
-89
+++ /dev/null
-#include <stdio.h>
-
-struct ziggy
-{
- int a;
- int b;
- int c;
-} bolshevic;
-
-int main()
-{
- int a;
- int *b;
- int c;
-
- a = 42;
- b = &a;
- printf("a = %d\n", *b);
-
- bolshevic.a = 12;
- bolshevic.b = 34;
- bolshevic.c = 56;
-
- printf("bolshevic.a = %d\n", bolshevic.a);
- printf("bolshevic.b = %d\n", bolshevic.b);
- printf("bolshevic.c = %d\n", bolshevic.c);
-
- struct ziggy *tsar = &bolshevic;
-
- printf("tsar->a = %d\n", tsar->a);
- printf("tsar->b = %d\n", tsar->b);
- printf("tsar->c = %d\n", tsar->c);
-
- b = &(bolshevic.b);
- printf("bolshevic.b = %d\n", *b);
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-a = 42
-bolshevic.a = 12
-bolshevic.b = 34
-bolshevic.c = 56
-tsar->a = 12
-tsar->b = 34
-tsar->c = 56
-bolshevic.b = 34
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- int b;
- int c;
- int d;
- int e;
- int f;
- int x;
- int y;
-
- a = 12;
- b = 34;
- c = 56;
- d = 78;
- e = 0;
- f = 1;
-
- printf("%d\n", c + d);
- printf("%d\n", (y = c + d));
- printf("%d\n", e || e && f);
- printf("%d\n", e || f && f);
- printf("%d\n", e && e || f);
- printf("%d\n", e && f || f);
- printf("%d\n", a && f | f);
- printf("%d\n", a | b ^ c & d);
- printf("%d, %d\n", a == a, a == b);
- printf("%d, %d\n", a != a, a != b);
- printf("%d\n", a != b && c != d);
- printf("%d\n", a + b * c / f);
- printf("%d\n", a + b * c / f);
- printf("%d\n", (4 << 4));
- printf("%d\n", (64 >> 4));
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-134
-134
-0
-1
-1
-1
-1
-46
-1, 0
-0, 1
-1
-1916
-1916
-64
-4
+++ /dev/null
-#include <stdio.h>
-
-#define FRED 12
-#define BLOGGS(x) (12*(x))
-
-int main()
-{
- printf("%d\n", FRED);
- printf("%d, %d, %d\n", BLOGGS(1), BLOGGS(2), BLOGGS(3));
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-12
-12, 24, 36
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a = 24680;
- int b = 01234567;
- int c = 0x2468ac;
- int d = 0x2468AC;
- int e = 0b010101010101;
-
- printf("%d\n", a);
- printf("%d\n", b);
- printf("%d\n", c);
- printf("%d\n", d);
- printf("%d\n", e);
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-24680
-342391
-2386092
-2386092
-1365
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a = 1;
-
- if (a)
- printf("a is true\n");
- else
- printf("a is false\n");
-
- int b = 0;
- if (b)
- printf("b is true\n");
- else
- printf("b is false\n");
-
- return 0;
-}
-
-// vim: set expandtab ts=4 sw=3 sts=3 tw=80 :
+++ /dev/null
-a is true
-b is false
+++ /dev/null
-#include <stdio.h>
-
-int factorial(int i)
-{
- if (i < 2)
- return i;
- else
- return i * factorial(i - 1);
-}
-
-int main()
-{
- int Count;
-
- for (Count = 1; Count <= 10; Count++)
- printf("%d\n", factorial(Count));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-2
-6
-24
-120
-720
-5040
-40320
-362880
-3628800
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int x, y, z;
-
- for (x = 0; x < 2; x++)
- {
- for (y = 0; y < 3; y++)
- {
- for (z = 0; z < 3; z++)
- {
- printf("%d %d %d\n", x, y, z);
- }
- }
- }
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-0 0 0
-0 0 1
-0 0 2
-0 1 0
-0 1 1
-0 1 2
-0 2 0
-0 2 1
-0 2 2
-1 0 0
-1 0 1
-1 0 2
-1 1 0
-1 1 1
-1 1 2
-1 2 0
-1 2 1
-1 2 2
+++ /dev/null
-#include <stdio.h>
-
-enum fred
-{
- a,
- b,
- c,
- d,
- e = 54,
- f = 73,
- g,
- h
-};
-
-int main()
-{
- enum fred frod;
-
- printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
- /* printf("%d\n", frod); */
- frod = 12;
- printf("%d\n", frod);
- frod = e;
- printf("%d\n", frod);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-0 1 2 3 54 73 74 75
-12
-54
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- printf("including\n");
-#include "18_include.h"
- printf("done\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-including
-included
-done
+++ /dev/null
-printf("included\n");
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- int *b;
- int *c;
-
- a = 42;
- b = &a;
- c = NULL;
-
- printf("%d\n", *b);
-
- if (b == NULL)
- printf("b is NULL\n");
- else
- printf("b is not NULL\n");
-
- if (c == NULL)
- printf("c is NULL\n");
- else
- printf("c is not NULL\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-42
-b is not NULL
-c is NULL
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- int b;
- int *d;
- int *e;
- d = &a;
- e = &b;
- a = 12;
- b = 34;
- printf("%d\n", *d);
- printf("%d\n", *e);
- printf("%d\n", d == e);
- printf("%d\n", d != e);
- d = e;
- printf("%d\n", d == e);
- printf("%d\n", d != e);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-12
-34
-0
-1
-1
-0
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int x = 'a';
- char y = x;
-
- char *a = "hello";
-
- printf("%s\n", a);
-
- int c;
- c = *a;
-
- char *b;
- for (b = a; *b != 0; b++)
- printf("%c: %d\n", *b, *b);
-
- char destarray[10];
- char *dest = &destarray[0];
- char *src = a;
-
- while (*src != 0)
- *dest++ = *src++;
-
- *dest = 0;
-
- printf("copied string is %s\n", destarray);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-hello
-h: 104
-e: 101
-l: 108
-l: 108
-o: 111
-copied string is hello
+++ /dev/null
-#include <stdio.h>
-#include <math.h>
-
-int main()
-{
- // variables
- float a = 12.34 + 56.78;
- printf("%f\n", a);
-
- // infix operators
- printf("%f\n", 12.34 + 56.78);
- printf("%f\n", 12.34 - 56.78);
- printf("%f\n", 12.34 * 56.78);
- printf("%f\n", 12.34 / 56.78);
-
- // comparison operators
- printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78);
- printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34);
- printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34);
-
- // assignment operators
- a = 12.34;
- a += 56.78;
- printf("%f\n", a);
-
- a = 12.34;
- a -= 56.78;
- printf("%f\n", a);
-
- a = 12.34;
- a *= 56.78;
- printf("%f\n", a);
-
- a = 12.34;
- a /= 56.78;
- printf("%f\n", a);
-
- // prefix operators
- printf("%f\n", +12.34);
- printf("%f\n", -12.34);
-
- // type coercion
- a = 2;
- printf("%f\n", a);
- printf("%f\n", sin(2));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-69.120003
-69.120000
--44.440000
-700.665200
-0.217330
-1 1 0 0 0 1
-0 1 1 1 0 0
-0 0 0 1 1 1
-69.120003
--44.439999
-700.665222
-0.217330
-12.340000
--12.340000
-2.000000
-0.909297
+++ /dev/null
-#include <stdio.h>
-
-void charfunc(char a)
-{
- printf("char: %c\n", a);
-}
-
-void intfunc(int a)
-{
- printf("int: %d\n", a);
-}
-
-void floatfunc(float a)
-{
- printf("float: %f\n", a);
-}
-
-int main()
-{
- charfunc('a');
- charfunc(98);
- charfunc(99.0);
-
- intfunc('a');
- intfunc(98);
- intfunc(99.0);
-
- floatfunc('a');
- floatfunc(98);
- floatfunc(99.0);
-
- /* printf("%c %d %f\n", 'a', 'b', 'c'); */
- /* printf("%c %d %f\n", 97, 98, 99); */
- /* printf("%c %d %f\n", 97.0, 98.0, 99.0); */
-
- char b = 97;
- char c = 97.0;
-
- printf("%d %d\n", b, c);
-
- int d = 'a';
- int e = 97.0;
-
- printf("%d %d\n", d, e);
-
- float f = 'a';
- float g = 97;
-
- printf("%f %f\n", f, g);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-char: a
-char: b
-char: c
-int: 97
-int: 98
-int: 99
-float: 97.000000
-float: 98.000000
-float: 99.000000
-97 97
-97 97
-97.000000 97.000000
+++ /dev/null
-#define _ISOC99_SOURCE 1
-
-#include <stdio.h>
-#include <math.h>
-
-int main()
-{
- printf("%f\n", sin(0.12));
- printf("%f\n", cos(0.12));
- printf("%f\n", tan(0.12));
- printf("%f\n", asin(0.12));
- printf("%f\n", acos(0.12));
- printf("%f\n", atan(0.12));
- printf("%f\n", sinh(0.12));
- printf("%f\n", cosh(0.12));
- printf("%f\n", tanh(0.12));
- printf("%f\n", exp(0.12));
- printf("%f\n", fabs(-0.12));
- printf("%f\n", log(0.12));
- printf("%f\n", log10(0.12));
- printf("%f\n", pow(0.12, 0.12));
- printf("%f\n", sqrt(0.12));
- printf("%f\n", round(12.34));
- printf("%f\n", ceil(12.34));
- printf("%f\n", floor(12.34));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-0.119712
-0.992809
-0.120579
-0.120290
-1.450506
-0.119429
-0.120288
-1.007209
-0.119427
-1.127497
-0.120000
--2.120264
--0.920819
-0.775357
-0.346410
-12.000000
-13.000000
-12.000000
+++ /dev/null
-#include <stdio.h>
-
-int array[16];
-
-//Swap integer values by array indexes
-void swap(int a, int b)
-{
- int tmp = array[a];
- array[a] = array[b];
- array[b] = tmp;
-}
-
-//Partition the array into two halves and return the
-//index about which the array is partitioned
-int partition(int left, int right)
-{
- int pivotIndex = left;
- int pivotValue = array[pivotIndex];
- int index = left;
- int i;
-
- swap(pivotIndex, right);
- for(i = left; i < right; i++)
- {
- if(array[i] < pivotValue)
- {
- swap(i, index);
- index += 1;
- }
- }
- swap(right, index);
-
- return index;
-}
-
-//Quicksort the array
-void quicksort(int left, int right)
-{
- if(left >= right)
- return;
-
- int index = partition(left, right);
- quicksort(left, index - 1);
- quicksort(index + 1, right);
-}
-
-int main()
-{
- int i;
-
- array[0] = 62;
- array[1] = 83;
- array[2] = 4;
- array[3] = 89;
- array[4] = 36;
- array[5] = 21;
- array[6] = 74;
- array[7] = 37;
- array[8] = 65;
- array[9] = 33;
- array[10] = 96;
- array[11] = 38;
- array[12] = 53;
- array[13] = 16;
- array[14] = 74;
- array[15] = 55;
-
- for (i = 0; i < 16; i++)
- printf("%d ", array[i]);
-
- printf("\n");
-
- quicksort(0, 15);
-
- for (i = 0; i < 16; i++)
- printf("%d ", array[i]);
-
- printf("\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-62 83 4 89 36 21 74 37 65 33 96 38 53 16 74 55
-4 16 21 33 36 37 38 53 55 62 65 74 74 83 89 96
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- printf("%d\n", '\1');
- printf("%d\n", '\10');
- printf("%d\n", '\100');
- printf("%d\n", '\x01');
- printf("%d\n", '\x0e');
- printf("%d\n", '\x10');
- printf("%d\n", '\x40');
- printf("test \x40\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-8
-64
-1
-14
-16
-64
-test @
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- char a;
- int b;
- double c;
-
- printf("%d\n", sizeof(a));
- printf("%d\n", sizeof(b));
- printf("%d\n", sizeof(c));
-
- printf("%d\n", sizeof(!a));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-4
-8
-4
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-int main()
-{
- char a[10];
-
- strcpy(a, "hello");
- printf("%s\n", a);
-
- strncpy(a, "gosh", 2);
- printf("%s\n", a);
-
- printf("%d\n", strcmp(a, "apple") > 0);
- printf("%d\n", strcmp(a, "goere") > 0);
- printf("%d\n", strcmp(a, "zebra") < 0);
-
- printf("%d\n", strlen(a));
-
- strcat(a, "!");
- printf("%s\n", a);
-
- printf("%d\n", strncmp(a, "apple", 2) > 0);
- printf("%d\n", strncmp(a, "goere", 2) == 0);
- printf("%d\n", strncmp(a, "goerg", 2) == 0);
- printf("%d\n", strncmp(a, "zebra", 2) < 0);
-
- printf("%s\n", strchr(a, 'o'));
- printf("%s\n", strrchr(a, 'l'));
- printf("%d\n", strrchr(a, 'x') == NULL);
-
- memset(&a[1], 'r', 4);
- printf("%s\n", a);
-
- memcpy(&a[2], a, 2);
- printf("%s\n", a);
-
- printf("%d\n", memcmp(a, "apple", 4) > 0);
- printf("%d\n", memcmp(a, "grgr", 4) == 0);
- printf("%d\n", memcmp(a, "zebra", 4) < 0);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-hello
-gollo
-1
-1
-1
-5
-gollo!
-1
-1
-1
-1
-ollo!
-lo!
-1
-grrrr!
-grgrr!
-1
-1
-1
+++ /dev/null
-#include <stdio.h>
-#include <string.h>
-
-int main()
-{
- char a[10];
- strcpy(a, "abcdef");
- printf("%s\n", &a[1]);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-/* example from http://barnyard.syr.edu/quickies/hanoi.c */
-
-/* hanoi.c: solves the tower of hanoi problem. (Programming exercise.) */
-/* By Terry R. McConnell (12/2/97) */
-/* Compile: cc -o hanoi hanoi.c */
-
-/* This program does no error checking. But then, if it's right,
- it's right ... right ? */
-
-
-/* The original towers of hanoi problem seems to have been originally posed
- by one M. Claus in 1883. There is a popular legend that goes along with
- it that has been often repeated and paraphrased. It goes something like this:
- In the great temple at Benares there are 3 golden spikes. On one of them,
- God placed 64 disks increasing in size from bottom to top, at the beginning
- of time. Since then, and to this day, the priest on duty constantly transfers
- disks, one at a time, in such a way that no larger disk is ever put on top
- of a smaller one. When the disks have been transferred entirely to another
- spike the Universe will come to an end in a large thunderclap.
-
- This paraphrases the original legend due to DeParville, La Nature, Paris 1884,
- Part I, 285-286. For this and further information see: Mathematical
- Recreations & Essays, W.W. Rouse Ball, MacMillan, NewYork, 11th Ed. 1967,
- 303-305.
- *
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#define TRUE 1
-#define FALSE 0
-
-/* This is the number of "disks" on tower A initially. Taken to be 64 in the
- * legend. The number of moves required, in general, is 2^N - 1. For N = 64,
- * this is 18,446,744,073,709,551,615 */
-#define N 4
-
-/* These are the three towers. For example if the state of A is 0,1,3,4, that
- * means that there are three discs on A of sizes 1, 3, and 4. (Think of right
- * as being the "down" direction.) */
-int A[N], B[N], C[N];
-
-void Hanoi(int,int*,int*,int*);
-
-/* Print the current configuration of A, B, and C to the screen */
-void PrintAll()
-{
- int i;
-
- printf("A: ");
- for(i=0;i<N;i++)printf(" %d ",A[i]);
- printf("\n");
-
- printf("B: ");
- for(i=0;i<N;i++)printf(" %d ",B[i]);
- printf("\n");
-
- printf("C: ");
- for(i=0;i<N;i++)printf(" %d ",C[i]);
- printf("\n");
- printf("------------------------------------------\n");
- return;
-}
-
-/* Move the leftmost nonzero element of source to dest, leave behind 0. */
-/* Returns the value moved (not used.) */
-int Move(int *source, int *dest)
-{
- int i = 0, j = 0;
-
- while (i<N && (source[i])==0) i++;
- while (j<N && (dest[j])==0) j++;
-
- dest[j-1] = source[i];
- source[i] = 0;
- PrintAll(); /* Print configuration after each move. */
- return dest[j-1];
-}
-
-
-/* Moves first n nonzero numbers from source to dest using the rules of Hanoi.
- Calls itself recursively.
- */
-void Hanoi(int n,int *source, int *dest, int *spare)
-{
- int i;
- if(n==1){
- Move(source,dest);
- return;
- }
-
- Hanoi(n-1,source,spare,dest);
- Move(source,dest);
- Hanoi(n-1,spare,dest,source);
- return;
-}
-
-int main()
-{
- int i;
-
- /* initialize the towers */
- for(i=0;i<N;i++)A[i]=i+1;
- for(i=0;i<N;i++)B[i]=0;
- for(i=0;i<N;i++)C[i]=0;
-
- printf("Solution of Tower of Hanoi Problem with %d Disks\n\n",N);
-
- /* Print the starting state */
- printf("Starting state:\n");
- PrintAll();
- printf("\n\nSubsequent states:\n\n");
-
- /* Do it! Use A = Source, B = Destination, C = Spare */
- Hanoi(N,A,B,C);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-Solution of Tower of Hanoi Problem with 4 Disks
-
-Starting state:
-A: 1 2 3 4
-B: 0 0 0 0
-C: 0 0 0 0
-------------------------------------------
-
-
-Subsequent states:
-
-A: 0 2 3 4
-B: 0 0 0 0
-C: 0 0 0 1
-------------------------------------------
-A: 0 0 3 4
-B: 0 0 0 2
-C: 0 0 0 1
-------------------------------------------
-A: 0 0 3 4
-B: 0 0 1 2
-C: 0 0 0 0
-------------------------------------------
-A: 0 0 0 4
-B: 0 0 1 2
-C: 0 0 0 3
-------------------------------------------
-A: 0 0 1 4
-B: 0 0 0 2
-C: 0 0 0 3
-------------------------------------------
-A: 0 0 1 4
-B: 0 0 0 0
-C: 0 0 2 3
-------------------------------------------
-A: 0 0 0 4
-B: 0 0 0 0
-C: 0 1 2 3
-------------------------------------------
-A: 0 0 0 0
-B: 0 0 0 4
-C: 0 1 2 3
-------------------------------------------
-A: 0 0 0 0
-B: 0 0 1 4
-C: 0 0 2 3
-------------------------------------------
-A: 0 0 0 2
-B: 0 0 1 4
-C: 0 0 0 3
-------------------------------------------
-A: 0 0 1 2
-B: 0 0 0 4
-C: 0 0 0 3
-------------------------------------------
-A: 0 0 1 2
-B: 0 0 3 4
-C: 0 0 0 0
-------------------------------------------
-A: 0 0 0 2
-B: 0 0 3 4
-C: 0 0 0 1
-------------------------------------------
-A: 0 0 0 0
-B: 0 2 3 4
-C: 0 0 0 1
-------------------------------------------
-A: 0 0 0 0
-B: 1 2 3 4
-C: 0 0 0 0
-------------------------------------------
+++ /dev/null
-#include <stdio.h>
-
-int main(int argc, char **argv)
-{
- int Count;
-
- printf("hello world %d\n", argc);
- for (Count = 1; Count < argc; Count++)
- printf("arg %d: %s\n", Count, argv[Count]);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-hello world 6
-arg 1: arg1
-arg 2: arg2
-arg 3: arg3
-arg 4: arg4
-arg 5: arg5
+++ /dev/null
-/* example from http://barnyard.syr.edu/quickies/led.c */
-
-/* led.c: print out number as if on 7 line led display. I.e., write integer
- given on command line like this:
- _ _ _
- | _| _| |_| |_
- | |_ _| | _| etc.
-
- We assume the terminal behaves like a classical teletype. So the top
- lines of all digits have to be printed first, then the middle lines of
- all digits, etc.
-
- By Terry R. McConnell
-
-compile: cc -o led led.c
-
-If you just want to link in the subroutine print_led that does all the
-work, compile with -DNO_MAIN, and declare the following in any source file
-that uses the call:
-
-extern void print_led(unsigned long x, char *buf);
-
-Bug: you cannot call repeatedly to print more than one number to a line.
-That would require curses or some other terminal API that allows moving the
-cursor to a previous line.
-
-*/
-
-
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#define MAX_DIGITS 32
-#define NO_MAIN
-
-
-/* Print the top line of the digit d into buffer.
- Does not null terminate buffer. */
-
-void topline(int d, char *p){
-
- *p++ = ' ';
- switch(d){
-
- /* all these have _ on top line */
-
- case 0:
- case 2:
- case 3:
- case 5:
- case 7:
- case 8:
- case 9:
- *p++ = '_';
- break;
- default:
- *p++=' ';
-
- }
- *p++=' ';
-}
-
-/* Print the middle line of the digit d into the buffer.
- Does not null terminate. */
-
-void midline(int d, char *p){
-
- switch(d){
-
- /* those that have leading | on middle line */
-
- case 0:
- case 4:
- case 5:
- case 6:
- case 8:
- case 9:
- *p++='|';
- break;
- default:
- *p++=' ';
- }
- switch(d){
-
- /* those that have _ on middle line */
-
- case 2:
- case 3:
- case 4:
- case 5:
- case 6:
- case 8:
- case 9:
- *p++='_';
- break;
- default:
- *p++=' ';
-
- }
- switch(d){
-
- /* those that have closing | on middle line */
-
- case 0:
- case 1:
- case 2:
- case 3:
- case 4:
- case 7:
- case 8:
- case 9:
- *p++='|';
- break;
- default:
- *p++=' ';
-
- }
-}
-
-/* Print the bottom line of the digit d. Does not null terminate. */
-
-void botline(int d, char *p){
-
-
- switch(d){
-
- /* those that have leading | on bottom line */
-
- case 0:
- case 2:
- case 6:
- case 8:
- *p++='|';
- break;
- default:
- *p++=' ';
- }
- switch(d){
-
- /* those that have _ on bottom line */
-
- case 0:
- case 2:
- case 3:
- case 5:
- case 6:
- case 8:
- *p++='_';
- break;
- default:
- *p++=' ';
-
- }
- switch(d){
-
- /* those that have closing | on bottom line */
-
- case 0:
- case 1:
- case 3:
- case 4:
- case 5:
- case 6:
- case 7:
- case 8:
- case 9:
- *p++='|';
- break;
- default:
- *p++=' ';
-
- }
-}
-
-/* Write the led representation of integer to string buffer. */
-
-void print_led(unsigned long x, char *buf)
-{
-
- int i=0,n;
- static int d[MAX_DIGITS];
-
-
- /* extract digits from x */
-
- n = ( x == 0L ? 1 : 0 ); /* 0 is a digit, hence a special case */
-
- while(x){
- d[n++] = (int)(x%10L);
- if(n >= MAX_DIGITS)break;
- x = x/10L;
- }
-
- /* print top lines of all digits */
-
- for(i=n-1;i>=0;i--){
- topline(d[i],buf);
- buf += 3;
- *buf++=' ';
- }
- *buf++='\n'; /* move teletype to next line */
-
- /* print middle lines of all digits */
-
- for(i=n-1;i>=0;i--){
- midline(d[i],buf);
- buf += 3;
- *buf++=' ';
- }
- *buf++='\n';
-
- /* print bottom lines of all digits */
-
- for(i=n-1;i>=0;i--){
- botline(d[i],buf);
- buf += 3;
- *buf++=' ';
- }
- *buf++='\n';
- *buf='\0';
-}
-
-int main()
-{
- char buf[5*MAX_DIGITS];
- print_led(1234567, buf);
- printf("%s\n",buf);
-
- return 0;
-}
-
-#ifndef NO_MAIN
-int main(int argc, char **argv)
-{
-
- int i=0,n;
- long x;
- static int d[MAX_DIGITS];
- char buf[5*MAX_DIGITS];
-
- if(argc != 2){
- fprintf(stderr,"led: usage: led integer\n");
- return 1;
- }
-
- /* fetch argument from command line */
-
- x = atol(argv[1]);
-
- /* sanity check */
-
- if(x<0){
- fprintf(stderr,"led: %d must be non-negative\n",x);
- return 1;
- }
-
- print_led(x,buf);
- printf("%s\n",buf);
-
- return 0;
-
-}
-#endif
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
- _ _ _ _
- | _| _| |_| |_ |_ |
- | |_ _| | _| |_| |
-
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count;
-
- for (Count = 0; Count < 10; Count++)
- {
- printf("%d\n", (Count < 5) ? (Count*Count) : (Count * 3));
- }
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-0
-1
-4
-9
-16
-15
-18
-21
-24
-27
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a[4];
-
- a[0] = 12;
- a[1] = 23;
- a[2] = 34;
- a[3] = 45;
-
- printf("%d %d %d %d\n", a[0], a[1], a[2], a[3]);
-
- int b[4];
-
- b = a;
-
- printf("%d %d %d %d\n", b[0], b[1], b[2], b[3]);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-12 23 34 45
-12 23 34 45
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- char a;
- short b;
-
- printf("%d %d\n", sizeof(char), sizeof(a));
- printf("%d %d\n", sizeof(short), sizeof(b));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count;
-
- int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };
-
- for (Count = 0; Count < 10; Count++)
- printf("%d: %d\n", Count, Array[Count]);
-
- int Array2[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753, };
-
- for (Count = 0; Count < 10; Count++)
- printf("%d: %d\n", Count, Array2[Count]);
-
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-0: 12
-1: 34
-2: 56
-3: 78
-4: 90
-5: 123
-6: 456
-7: 789
-8: 8642
-9: 9753
-0: 12
-1: 34
-2: 56
-3: 78
-4: 90
-5: 123
-6: 456
-7: 789
-8: 8642
-9: 9753
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- char Buf[100];
- int Count;
-
- for (Count = 1; Count <= 20; Count++)
- {
- sprintf(Buf, "->%02d<-\n", Count);
- printf("%s", Buf);
- }
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-->01<-
-->02<-
-->03<-
-->04<-
-->05<-
-->06<-
-->07<-
-->08<-
-->09<-
-->10<-
-->11<-
-->12<-
-->13<-
-->14<-
-->15<-
-->16<-
-->17<-
-->18<-
-->19<-
-->20<-
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a[4][4];
- int b = 0;
- int x;
- int y;
-
- for (x = 0; x < 4; x++)
- {
- for (y = 0; y < 4; y++)
- {
- b++;
- a[x][y] = b;
- }
- }
-
- for (x = 0; x < 4; x++)
- {
- printf("x=%d: ", x);
- for (y = 0; y < 4; y++)
- {
- printf("%d ", a[x][y]);
- }
- printf("\n");
- }
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-x=0: 1 2 3 4
-x=1: 5 6 7 8
-x=2: 9 10 11 12
-x=3: 13 14 15 16
+++ /dev/null
-#include <stdio.h>
-
-typedef int MyInt;
-
-struct FunStruct
-{
- int i;
- int j;
-};
-
-typedef struct FunStruct MyFunStruct;
-
-typedef MyFunStruct *MoreFunThanEver;
-
-int main()
-{
- MyInt a = 1;
- printf("%d\n", a);
-
- MyFunStruct b;
- b.i = 12;
- b.j = 34;
- printf("%d,%d\n", b.i, b.j);
-
- MoreFunThanEver c = &b;
- printf("%d,%d\n", c->i, c->j);
-
- return 0;
-}
-
-/* "If the specification of an array type includes any type qualifiers,
- the element type is so-qualified, not the array type." */
-
-typedef int A[3];
-extern A const ca;
-extern const A ca;
-extern const int ca[3];
-
-typedef A B[1][2];
-extern B const cb;
-extern const B cb;
-extern const int cb[1][2][3];
-
-extern B b;
-extern int b[1][2][3];
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-12,34
-12,34
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- FILE *f = fopen("fred.txt", "w");
- fwrite("hello\nhello\n", 1, 12, f);
- fclose(f);
-
- char freddy[7];
- f = fopen("fred.txt", "r");
- if (fread(freddy, 1, 6, f) != 6)
- printf("couldn't read fred.txt\n");
-
- freddy[6] = '\0';
- fclose(f);
-
- printf("%s", freddy);
-
- int InChar;
- char ShowChar;
- f = fopen("fred.txt", "r");
- while ( (InChar = fgetc(f)) != EOF)
- {
- ShowChar = InChar;
- if (ShowChar < ' ')
- ShowChar = '.';
-
- printf("ch: %d '%c'\n", InChar, ShowChar);
- }
- fclose(f);
-
- f = fopen("fred.txt", "r");
- while ( (InChar = getc(f)) != EOF)
- {
- ShowChar = InChar;
- if (ShowChar < ' ')
- ShowChar = '.';
-
- printf("ch: %d '%c'\n", InChar, ShowChar);
- }
- fclose(f);
-
- f = fopen("fred.txt", "r");
- while (fgets(freddy, sizeof(freddy), f) != NULL)
- printf("x: %s", freddy);
-
- fclose(f);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-hello
-ch: 104 'h'
-ch: 101 'e'
-ch: 108 'l'
-ch: 108 'l'
-ch: 111 'o'
-ch: 10 '.'
-ch: 104 'h'
-ch: 101 'e'
-ch: 108 'l'
-ch: 108 'l'
-ch: 111 'o'
-ch: 10 '.'
-ch: 104 'h'
-ch: 101 'e'
-ch: 108 'l'
-ch: 108 'l'
-ch: 111 'o'
-ch: 10 '.'
-ch: 104 'h'
-ch: 101 'e'
-ch: 108 'l'
-ch: 108 'l'
-ch: 111 'o'
-ch: 10 '.'
-x: hello
-x: hello
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- printf("#include test\n");
-
-#if 1
-#if 0
- printf("a\n");
-#else
- printf("b\n");
-#endif
-#else
-#if 0
- printf("c\n");
-#else
- printf("d\n");
-#endif
-#endif
-
-#if 0
-#if 1
- printf("e\n");
-#else
- printf("f\n");
-#endif
-#else
-#if 1
- printf("g\n");
-#else
- printf("h\n");
-#endif
-#endif
-
-#define DEF
-
-#ifdef DEF
-#ifdef DEF
- printf("i\n");
-#else
- printf("j\n");
-#endif
-#else
-#ifdef DEF
- printf("k\n");
-#else
- printf("l\n");
-#endif
-#endif
-
-#ifndef DEF
-#ifndef DEF
- printf("m\n");
-#else
- printf("n\n");
-#endif
-#else
-#ifndef DEF
- printf("o\n");
-#else
- printf("p\n");
-#endif
-#endif
-
-#define ONE 1
-#define ZERO 0
-
-#if ONE
-#if ZERO
- printf("q\n");
-#else
- printf("r\n");
-#endif
-#else
-#if ZERO
- printf("s\n");
-#else
- printf("t\n");
-#endif
-#endif
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-#include test
-b
-g
-i
-p
-r
+++ /dev/null
-#include <stdio.h>
-
-int fred(int p)
-{
- printf("yo %d\n", p);
- return 42;
-}
-
-int (*f)(int) = &fred;
-
-/* To test what this is supposed to test the destination function
- (fprint here) must not be called directly anywhere in the test. */
-int (*fprintfptr)(FILE *, const char *, ...) = &fprintf;
-
-int main()
-{
- fprintfptr(stdout, "%d\n", (*f)(24));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-#include <stdio.h>
-
-void fred(void)
-{
- printf("yo\n");
-}
-
-int main()
-{
- fred();
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
-
- for (a = 0; a < 2; a++)
- {
- int b = a;
- }
-
- printf("it's all good\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-it's all good
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int Count = 0;
-
- for (;;)
- {
- Count++;
- printf("%d\n", Count);
- if (Count >= 10)
- break;
- }
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-2
-3
-4
-5
-6
-7
-8
-9
-10
+++ /dev/null
-#include <stdio.h>
-
-void fred(int x)
-{
- switch (x)
- {
- case 1: printf("1\n"); return;
- case 2: printf("2\n"); break;
- case 3: printf("3\n"); return;
- }
-
- printf("out\n");
-}
-
-int main()
-{
- fred(1);
- fred(2);
- fred(3);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1
-2
-out
-3
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- int a;
- char b;
-
- a = 0;
- while (a < 2)
- {
- printf("%d", a++);
- break;
-
- b = 'A';
- while (b < 'C')
- {
- printf("%c", b++);
- }
- printf("e");
- }
- printf("\n");
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-#include <stdio.h>
-
-struct point
-{
- double x;
- double y;
-};
-
-struct point point_array[100];
-
-int main()
-{
- int my_point = 10;
-
- point_array[my_point].x = 12.34;
- point_array[my_point].y = 56.78;
-
- printf("%f, %f\n", point_array[my_point].x, point_array[my_point].y);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-12.340000, 56.780000
+++ /dev/null
-#include <stdio.h>
-
-int fred()
-{
- printf("fred\n");
- return 0;
-}
-
-int joe()
-{
- printf("joe\n");
- return 1;
-}
-
-int main()
-{
- printf("%d\n", fred() && joe());
- printf("%d\n", fred() || joe());
- printf("%d\n", joe() && fred());
- printf("%d\n", joe() || fred());
- printf("%d\n", fred() && (1 + joe()));
- printf("%d\n", fred() || (0 + joe()));
- printf("%d\n", joe() && (0 + fred()));
- printf("%d\n", joe() || (1 + fred()));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-fred
-0
-fred
-joe
-1
-joe
-fred
-0
-joe
-1
-fred
-0
-fred
-joe
-1
-joe
-fred
-0
-joe
-1
+++ /dev/null
-#include <stdio.h>
-
-static int fred = 1234;
-static int joe;
-
-void henry()
-{
- static int fred = 4567;
-
- printf("%d\n", fred);
- fred++;
-}
-
-int main()
-{
- printf("%d\n", fred);
- henry();
- henry();
- henry();
- henry();
- printf("%d\n", fred);
- fred = 8901;
- joe = 2345;
- printf("%d\n", fred);
- printf("%d\n", joe);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-1234
-4567
-4568
-4569
-4570
-1234
-8901
-2345
+++ /dev/null
-#include <stdio.h>
-
-enum fred { a, b, c };
-
-int main()
-{
- printf("a=%d\n", a);
- printf("b=%d\n", b);
- printf("c=%d\n", c);
-
- enum fred d;
-
- typedef enum { e, f, g } h;
- typedef enum { i, j, k } m;
-
- printf("e=%d\n", e);
- printf("f=%d\n", f);
- printf("g=%d\n", g);
-
- printf("i=%d\n", i);
- printf("j=%d\n", j);
- printf("k=%d\n", k);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-a=0
-b=1
-c=2
-e=0
-f=1
-g=2
-i=0
-j=1
-k=2
+++ /dev/null
-#include <stdio.h>
-
-void fred()
-{
- printf("In fred()\n");
- goto done;
- printf("In middle\n");
-done:
- printf("At end\n");
-}
-
-void joe()
-{
- int b = 5678;
-
- printf("In joe()\n");
-
- {
- int c = 1234;
- printf("c = %d\n", c);
- goto outer;
- printf("uh-oh\n");
- }
-
-outer:
-
- printf("done\n");
-}
-
-void henry()
-{
- int a;
-
- printf("In henry()\n");
- goto inner;
-
- {
- int b;
-inner:
- b = 1234;
- printf("b = %d\n", b);
- }
-
- printf("done\n");
-}
-
-int main()
-{
- fred();
- joe();
- henry();
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-In fred()
-At end
-In joe()
-c = 1234
-done
-In henry()
-b = 1234
-done
+++ /dev/null
-/* $Id: lshift-type.c 53089 2012-07-06 11:18:26Z vinc17/ypig $
-
-Tests on left-shift type, written by Vincent Lefevre <vincent@vinc17.net>.
-
-ISO C99 TC3 says: [6.5.7#3] "The integer promotions are performed on
-each of the operands. The type of the result is that of the promoted
-left operand."
-*/
-
-#include <stdio.h>
-
-#define PTYPE(M) ((M) < 0 || -(M) < 0 ? -1 : 1) * (int) sizeof((M)+0)
-#define CHECK(X,T) check(#X, PTYPE(X), PTYPE((X) << (T) 1))
-#define TEST1(X,T) do { CHECK(X,T); CHECK(X,unsigned T); } while (0)
-#define TEST2(X) \
- do \
- { \
- TEST1((X),short); \
- TEST1((X),int); \
- TEST1((X),long); \
- TEST1((X),long long); \
- } \
- while (0)
-#define TEST3(X,T) do { TEST2((T)(X)); TEST2((unsigned T)(X)); } while (0)
-#define TEST4(X) \
- do \
- { \
- TEST3((X),short); \
- TEST3((X),int); \
- TEST3((X),long); \
- TEST3((X),long long); \
- } \
- while (0)
-
-static int debug, nfailed = 0;
-
-static void check (const char *s, int arg1, int shift)
-{
- int failed = arg1 != shift;
- if (debug || failed)
- printf ("%s %d %d\n", s, arg1, shift);
- nfailed += failed;
-}
-
-int main (int argc, char **argv)
-{
- debug = argc > 1;
- TEST4(1);
- TEST4(-1);
- printf ("%d test(s) failed\n", nfailed);
- return nfailed != 0;
-}
+++ /dev/null
-0 test(s) failed
+++ /dev/null
-struct A {} int i;
+++ /dev/null
-56_btype_excess-1.c:1: error: too many basic types
+++ /dev/null
-char int i;
+++ /dev/null
-57_btype_excess-2.c:1: error: too many basic types
+++ /dev/null
-int f(void)
-{
- return 0;
-}
-
-int f(void)
-{
- return 1;
-}
+++ /dev/null
-58_function_redefinition.c:7: error: redefinition of 'f'
+++ /dev/null
-int (*fct)[42](int x);
+++ /dev/null
-59_function_array.c:1: error: declaration of an array of functions
+++ /dev/null
-enum color {RED, GREEN, BLUE};
-enum color {R, G, B};
-
-enum color c;
+++ /dev/null
-60_enum_redefinition.c:2: error: struct/union/enum already defined
+++ /dev/null
-enum rgb c = 42;
+++ /dev/null
-61_undefined_enum.c:1: error: unknown type size
+++ /dev/null
-enum color {RED, GREEN, BLUE};
-enum rgb {RED, G, B};
-
-enum color c = RED;
+++ /dev/null
-62_enumerator_redefinition.c:2: error: redefinition of enumerator 'RED'
+++ /dev/null
-enum {
- FOO,
- BAR
-};
-
-int main(void)
-{
- enum {
- FOO = 2,
- BAR
- };
-
- return BAR - FOO;
-}
+++ /dev/null
-#include <stdio.h> // printf()
-
-#define CAT2(a,b) a##b
-#define CAT(a,b) CAT2(a,b)
-#define AB(x) CAT(x,y)
-
-int main(void)
-{
- int xy = 42;
- printf("%d\n", CAT(A,B)(x));
- return 0;
-}
+++ /dev/null
-#include <stdio.h>
-
-#define P(A,B) A ## B ; bob
-#define Q(A,B) A ## B+
-
-int main(void)
-{
- int bob, jim = 21;
- bob = P(jim,) *= 2;
- printf("jim: %d, bob: %d\n", jim, bob);
- jim = 60 Q(+,)3;
- printf("jim: %d\n", jim);
- return 0;
-}
+++ /dev/null
-jim: 21, bob: 42
-jim: 63
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- /* decimal floating constant */
- float fa0 = .123f;
- float fa1 = .123E12F;
- float fa2 = .123e-12f;
- float fa3 = .123e+12f;
- printf("%f\n%f\n%f\n%f\n\n", fa0, fa1, fa2, fa3);
-
- float fb0 = 123.123f;
- float fb1 = 123.123E12F;
- float fb2 = 123.123e-12f;
- float fb3 = 123.123e+12f;
- printf("%f\n%f\n%f\n%f\n\n", fb0, fb1, fb2, fb3);
-
- float fc0 = 123.f;
- float fc1 = 123.E12F;
- float fc2 = 123.e-12f;
- float fc3 = 123.e+12f;
- printf("%f\n%f\n%f\n%f\n\n", fc0, fc1, fc2, fc3);
-
- float fd0 = 123E12F;
- float fd1 = 123e-12f;
- float fd2 = 123e+12f;
- printf("%f\n%f\n%f\n\n", fd0, fd1, fd2);
- printf("\n");
-
- /* hexadecimal floating constant */
- double da0 = 0X.1ACP12;
- double da1 = 0x.1acp-12;
- double da2 = 0x.1acp+12;
- printf("%f\n%f\n%f\n\n", da0, da1, da2);
-
- double db0 = 0X1AC.BDP12;
- double db1 = 0x1ac.bdp-12;
- double db2 = 0x1ac.dbp+12;
- printf("%f\n%f\n%f\n\n", db0, db1, db2);
-
- double dc0 = 0X1AC.P12;
- double dc1 = 0x1ac.p-12;
- double dc2 = 0x1ac.p+12;
- printf("%f\n%f\n%f\n\n", dc0, dc1, dc2);
-
- double dd0 = 0X1ACP12;
- double dd1 = 0x1acp-12;
- double dd2 = 0x1acp+12;
- printf("%f\n%f\n%f\n\n", dd0, dd1, dd2);
- printf("\n");
-
-#ifdef __TINYC__
- /* TCC extension
- binary floating constant */
- long double la0 = 0B.110101100P12L;
- long double la1 = 0b.110101100p-12l;
- long double la2 = 0b.110101100p+12l;
- printf("%Lf\n%Lf\n%Lf\n\n", la0, la1, la2);
-
- long double lb0 = 0B110101100.10111101P12L;
- long double lb1 = 0b110101100.10111101p-12l;
- long double lb2 = 0b110101100.10111101p+12l;
- printf("%Lf\n%Lf\n%Lf\n\n", lb0, lb1, lb2);
-
- long double lc0 = 0B110101100.P12L;
- long double lc1 = 0b110101100.p-12l;
- long double lc2 = 0b110101100.p+12l;
- printf("%Lf\n%Lf\n%Lf\n\n", lc0, lc1, lc2);
-
- long double ld0 = 0B110101100P12L;
- long double ld1 = 0b110101100p-12l;
- long double ld2 = 0b110101100p+12l;
- printf("%Lf\n%Lf\n%Lf\n\n", ld0, ld1, ld2);
-#endif
-
- return 0;
-}
+++ /dev/null
-0.123000
-122999996416.000000
-0.000000
-122999996416.000000
-
-123.123001
-123122997002240.000000
-0.000000
-123122997002240.000000
-
-123.000000
-123000003231744.000000
-0.000000
-123000003231744.000000
-
-123000003231744.000000
-0.000000
-123000003231744.000000
-
-
-428.000000
-0.000026
-428.000000
-
-1756112.000000
-0.104672
-1756592.000000
-
-1753088.000000
-0.104492
-1753088.000000
-
-1753088.000000
-0.104492
-1753088.000000
-
-
-3424.000000
-0.000204
-3424.000000
-
-1756112.000000
-0.104672
-1756112.000000
-
-1753088.000000
-0.104492
-1753088.000000
-
-1753088.000000
-0.104492
-1753088.000000
-
+++ /dev/null
-#include <stdio.h>
-
-#define T(a,b,c) a b c
-
-int main(void)
-{
- printf("%d", T(1,+,2) T(+,,) T(,2,*) T(,7,) T(,,));
- return 0;
-}
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- long long int res = 0;
-
- if (res < -2147483648LL) {
- printf("Error: 0 < -2147483648\n");
- return 1;
- }
- else
- if (2147483647LL < res) {
- printf("Error: 2147483647 < 0\n");
- return 2;
- }
- else
- printf("long long constant test ok.\n");
- return 0;
-}
+++ /dev/null
-long long constant test ok.
+++ /dev/null
-// This program is designed to test some arm64-specific things, such as the
-// calling convention, but should give the same results on any architecture.
-
-#include <stdarg.h>
-#include <stdint.h>
-#include <stdio.h>
-
-struct s1 { char x[1]; } s1 = { "0" };
-struct s2 { char x[2]; } s2 = { "12" };
-struct s3 { char x[3]; } s3 = { "345" };
-struct s4 { char x[4]; } s4 = { "6789" };
-struct s5 { char x[5]; } s5 = { "abcde" };
-struct s6 { char x[6]; } s6 = { "fghijk" };
-struct s7 { char x[7]; } s7 = { "lmnopqr" };
-struct s8 { char x[8]; } s8 = { "stuvwxyz" };
-struct s9 { char x[9]; } s9 = { "ABCDEFGHI" };
-struct s10 { char x[10]; } s10 = { "JKLMNOPQRS" };
-struct s11 { char x[11]; } s11 = { "TUVWXYZ0123" };
-struct s12 { char x[12]; } s12 = { "456789abcdef" };
-struct s13 { char x[13]; } s13 = { "ghijklmnopqrs" };
-struct s14 { char x[14]; } s14 = { "tuvwxyzABCDEFG" };
-struct s15 { char x[15]; } s15 = { "HIJKLMNOPQRSTUV" };
-struct s16 { char x[16]; } s16 = { "WXYZ0123456789ab" };
-struct s17 { char x[17]; } s17 = { "cdefghijklmnopqrs" };
-
-struct hfa11 { float a; } hfa11 = { 11.1 };
-struct hfa12 { float a, b; } hfa12 = { 12.1, 12.2 };
-struct hfa13 { float a, b, c; } hfa13 = { 13.1, 13.2, 13.3 };
-struct hfa14 { float a, b, c, d; } hfa14 = { 14.1, 14.2, 14.3, 14.4 };
-
-struct hfa21 { double a; } hfa21 = { 21.1 };
-struct hfa22 { double a, b; } hfa22 = { 22.1, 22.2 };
-struct hfa23 { double a, b, c; } hfa23 = { 23.1, 23.2, 23.3 };
-struct hfa24 { double a, b, c, d; } hfa24 = { 24.1, 24.2, 24.3, 24.4 };
-
-struct hfa31 { long double a; } hfa31 = { 31.1 };
-struct hfa32 { long double a, b; } hfa32 = { 32.1, 32.2 };
-struct hfa33 { long double a, b, c; } hfa33 = { 33.1, 33.2, 33.3 };
-struct hfa34 { long double a, b, c, d; } hfa34 = { 34.1, 34.2, 34.3, 34.4 };
-
-void fa_s1(struct s1 a) { printf("%.1s\n", a.x); }
-void fa_s2(struct s2 a) { printf("%.2s\n", a.x); }
-void fa_s3(struct s3 a) { printf("%.3s\n", a.x); }
-void fa_s4(struct s4 a) { printf("%.4s\n", a.x); }
-void fa_s5(struct s5 a) { printf("%.5s\n", a.x); }
-void fa_s6(struct s6 a) { printf("%.6s\n", a.x); }
-void fa_s7(struct s7 a) { printf("%.7s\n", a.x); }
-void fa_s8(struct s8 a) { printf("%.8s\n", a.x); }
-void fa_s9(struct s9 a) { printf("%.9s\n", a.x); }
-void fa_s10(struct s10 a) { printf("%.10s\n", a.x); }
-void fa_s11(struct s11 a) { printf("%.11s\n", a.x); }
-void fa_s12(struct s12 a) { printf("%.12s\n", a.x); }
-void fa_s13(struct s13 a) { printf("%.13s\n", a.x); }
-void fa_s14(struct s14 a) { printf("%.14s\n", a.x); }
-void fa_s15(struct s15 a) { printf("%.15s\n", a.x); }
-void fa_s16(struct s16 a) { printf("%.16s\n", a.x); }
-void fa_s17(struct s17 a) { printf("%.17s\n", a.x); }
-
-void fa_hfa11(struct hfa11 a)
-{ printf("%.1f\n", a.a); }
-void fa_hfa12(struct hfa12 a)
-{ printf("%.1f %.1f\n", a.a, a.a); }
-void fa_hfa13(struct hfa13 a)
-{ printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
-void fa_hfa14(struct hfa14 a)
-{ printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
-
-void fa_hfa21(struct hfa21 a)
-{ printf("%.1f\n", a.a); }
-void fa_hfa22(struct hfa22 a)
-{ printf("%.1f %.1f\n", a.a, a.a); }
-void fa_hfa23(struct hfa23 a)
-{ printf("%.1f %.1f %.1f\n", a.a, a.b, a.c); }
-void fa_hfa24(struct hfa24 a)
-{ printf("%.1f %.1f %.1f %.1f\n", a.a, a.b, a.c, a.d); }
-
-void fa_hfa31(struct hfa31 a)
-{ printf("%.1Lf\n", a.a); }
-void fa_hfa32(struct hfa32 a)
-{ printf("%.1Lf %.1Lf\n", a.a, a.a); }
-void fa_hfa33(struct hfa33 a)
-{ printf("%.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c); }
-void fa_hfa34(struct hfa34 a)
-{ printf("%.1Lf %.1Lf %.1Lf %.1Lf\n", a.a, a.b, a.c, a.d); }
-
-void fa1(struct s8 a, struct s9 b, struct s10 c, struct s11 d,
- struct s12 e, struct s13 f)
-{
- printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
-}
-
-void fa2(struct s9 a, struct s10 b, struct s11 c, struct s12 d,
- struct s13 e, struct s14 f)
-{
- printf("%.3s %.3s %.3s %.3s %.3s %.3s\n", a.x, b.x, c.x, d.x, e.x, f.x);
-}
-
-void fa3(struct hfa14 a, struct hfa23 b, struct hfa32 c)
-{
- printf("%.1f %.1f %.1f %.1f %.1Lf %.1Lf\n",
- a.a, a.d, b.a, b.c, c.a, c.b);
-}
-
-void fa4(struct s1 a, struct hfa14 b, struct s2 c, struct hfa24 d,
- struct s3 e, struct hfa34 f)
-{
- printf("%.1s %.1f %.1f %.2s %.1f %.1f %.3s %.1Lf %.1Lf\n",
- a.x, b.a, b.d, c.x, d.a, d.d, e.x, f.a, f.d);
-}
-
-void arg(void)
-{
- printf("Arguments:\n");
- fa_s1(s1);
- fa_s2(s2);
- fa_s3(s3);
- fa_s4(s4);
- fa_s5(s5);
- fa_s6(s6);
- fa_s7(s7);
- fa_s8(s8);
- fa_s9(s9);
- fa_s10(s10);
- fa_s11(s11);
- fa_s12(s12);
- fa_s13(s13);
- fa_s14(s14);
- fa_s15(s15);
- fa_s16(s16);
- fa_s17(s17);
- fa_hfa11(hfa11);
- fa_hfa12(hfa12);
- fa_hfa13(hfa13);
- fa_hfa14(hfa14);
- fa_hfa21(hfa21);
- fa_hfa22(hfa22);
- fa_hfa23(hfa23);
- fa_hfa24(hfa24);
- fa_hfa31(hfa31);
- fa_hfa32(hfa32);
- fa_hfa33(hfa33);
- fa_hfa34(hfa34);
- fa1(s8, s9, s10, s11, s12, s13);
- fa2(s9, s10, s11, s12, s13, s14);
- fa3(hfa14, hfa23, hfa32);
- fa4(s1, hfa14, s2, hfa24, s3, hfa34);
-}
-
-struct s1 fr_s1(void) { return s1; }
-struct s2 fr_s2(void) { return s2; }
-struct s3 fr_s3(void) { return s3; }
-struct s4 fr_s4(void) { return s4; }
-struct s5 fr_s5(void) { return s5; }
-struct s6 fr_s6(void) { return s6; }
-struct s7 fr_s7(void) { return s7; }
-struct s8 fr_s8(void) { return s8; }
-struct s9 fr_s9(void) { return s9; }
-struct s10 fr_s10(void) { return s10; }
-struct s11 fr_s11(void) { return s11; }
-struct s12 fr_s12(void) { return s12; }
-struct s13 fr_s13(void) { return s13; }
-struct s14 fr_s14(void) { return s14; }
-struct s15 fr_s15(void) { return s15; }
-struct s16 fr_s16(void) { return s16; }
-struct s17 fr_s17(void) { return s17; }
-
-struct hfa11 fr_hfa11(void) { return hfa11; }
-struct hfa12 fr_hfa12(void) { return hfa12; }
-struct hfa13 fr_hfa13(void) { return hfa13; }
-struct hfa14 fr_hfa14(void) { return hfa14; }
-
-struct hfa21 fr_hfa21(void) { return hfa21; }
-struct hfa22 fr_hfa22(void) { return hfa22; }
-struct hfa23 fr_hfa23(void) { return hfa23; }
-struct hfa24 fr_hfa24(void) { return hfa24; }
-
-struct hfa31 fr_hfa31(void) { return hfa31; }
-struct hfa32 fr_hfa32(void) { return hfa32; }
-struct hfa33 fr_hfa33(void) { return hfa33; }
-struct hfa34 fr_hfa34(void) { return hfa34; }
-
-void ret(void)
-{
- struct s1 t1 = fr_s1();
- struct s2 t2 = fr_s2();
- struct s3 t3 = fr_s3();
- struct s4 t4 = fr_s4();
- struct s5 t5 = fr_s5();
- struct s6 t6 = fr_s6();
- struct s7 t7 = fr_s7();
- struct s8 t8 = fr_s8();
- struct s9 t9 = fr_s9();
- struct s10 t10 = fr_s10();
- struct s11 t11 = fr_s11();
- struct s12 t12 = fr_s12();
- struct s13 t13 = fr_s13();
- struct s14 t14 = fr_s14();
- struct s15 t15 = fr_s15();
- struct s16 t16 = fr_s16();
- struct s17 t17 = fr_s17();
- printf("Return values:\n");
- printf("%.1s\n", t1.x);
- printf("%.2s\n", t2.x);
- printf("%.3s\n", t3.x);
- printf("%.4s\n", t4.x);
- printf("%.5s\n", t5.x);
- printf("%.6s\n", t6.x);
- printf("%.7s\n", t7.x);
- printf("%.8s\n", t8.x);
- printf("%.9s\n", t9.x);
- printf("%.10s\n", t10.x);
- printf("%.11s\n", t11.x);
- printf("%.12s\n", t12.x);
- printf("%.13s\n", t13.x);
- printf("%.14s\n", t14.x);
- printf("%.15s\n", t15.x);
- printf("%.16s\n", t16.x);
- printf("%.17s\n", t17.x);
- printf("%.1f\n", fr_hfa11().a);
- printf("%.1f %.1f\n", fr_hfa12().a, fr_hfa12().b);
- printf("%.1f %.1f\n", fr_hfa13().a, fr_hfa13().c);
- printf("%.1f %.1f\n", fr_hfa14().a, fr_hfa14().d);
- printf("%.1f\n", fr_hfa21().a);
- printf("%.1f %.1f\n", fr_hfa22().a, fr_hfa22().b);
- printf("%.1f %.1f\n", fr_hfa23().a, fr_hfa23().c);
- printf("%.1f %.1f\n", fr_hfa24().a, fr_hfa24().d);
- printf("%.1Lf\n", fr_hfa31().a);
- printf("%.1Lf %.1Lf\n", fr_hfa32().a, fr_hfa32().b);
- printf("%.1Lf %.1Lf\n", fr_hfa33().a, fr_hfa33().c);
- printf("%.1Lf %.1Lf\n", fr_hfa34().a, fr_hfa34().d);
-}
-
-int match(const char **s, const char *f)
-{
- const char *p = *s;
- for (p = *s; *f && *f == *p; f++, p++)
- ;
- if (!*f) {
- *s = p - 1;
- return 1;
- }
- return 0;
-}
-
-void myprintf(const char *format, ...)
-{
- const char *s;
- va_list ap;
- va_start(ap, format);
- for (s = format; *s; s++) {
- if (match(&s, "%7s")) {
- struct s7 t7 = va_arg(ap, struct s7);
- printf("%.7s", t7.x);
- }
- else if (match(&s, "%9s")) {
- struct s9 t9 = va_arg(ap, struct s9);
- printf("%.9s", t9.x);
- }
- else if (match(&s, "%hfa11")) {
- struct hfa11 x = va_arg(ap, struct hfa11);
- printf("%.1f,%.1f", x.a, x.a);
- }
- else if (match(&s, "%hfa12")) {
- struct hfa12 x = va_arg(ap, struct hfa12);
- printf("%.1f,%.1f", x.a, x.b);
- }
- else if (match(&s, "%hfa13")) {
- struct hfa13 x = va_arg(ap, struct hfa13);
- printf("%.1f,%.1f", x.a, x.c);
- }
- else if (match(&s, "%hfa14")) {
- struct hfa14 x = va_arg(ap, struct hfa14);
- printf("%.1f,%.1f", x.a, x.d);
- }
- else if (match(&s, "%hfa21")) {
- struct hfa21 x = va_arg(ap, struct hfa21);
- printf("%.1f,%.1f", x.a, x.a);
- }
- else if (match(&s, "%hfa22")) {
- struct hfa22 x = va_arg(ap, struct hfa22);
- printf("%.1f,%.1f", x.a, x.b);
- }
- else if (match(&s, "%hfa23")) {
- struct hfa23 x = va_arg(ap, struct hfa23);
- printf("%.1f,%.1f", x.a, x.c);
- }
- else if (match(&s, "%hfa24")) {
- struct hfa24 x = va_arg(ap, struct hfa24);
- printf("%.1f,%.1f", x.a, x.d);
- }
- else if (match(&s, "%hfa31")) {
- struct hfa31 x = va_arg(ap, struct hfa31);
- printf("%.1Lf,%.1Lf", x.a, x.a);
- }
- else if (match(&s, "%hfa32")) {
- struct hfa32 x = va_arg(ap, struct hfa32);
- printf("%.1Lf,%.1Lf", x.a, x.b);
- }
- else if (match(&s, "%hfa33")) {
- struct hfa33 x = va_arg(ap, struct hfa33);
- printf("%.1Lf,%.1Lf", x.a, x.c);
- }
- else if (match(&s, "%hfa34")) {
- struct hfa34 x = va_arg(ap, struct hfa34);
- printf("%.1Lf,%.1Lf", x.a, x.d);
- }
- else
- putchar(*s);
- }
- putchar('\n');
-}
-
-void stdarg(void)
-{
- printf("stdarg:\n");
- myprintf("%9s %9s %9s %9s %9s %9s", s9, s9, s9, s9, s9, s9);
- myprintf("%7s %9s %9s %9s %9s %9s", s7, s9, s9, s9, s9, s9);
-
- myprintf("HFA long double:");
- myprintf("%hfa34 %hfa34 %hfa34 %hfa34", hfa34, hfa34, hfa34, hfa34);
- myprintf("%hfa33 %hfa34 %hfa34 %hfa34", hfa33, hfa34, hfa34, hfa34);
- myprintf("%hfa32 %hfa34 %hfa34 %hfa34", hfa32, hfa34, hfa34, hfa34);
- myprintf("%hfa31 %hfa34 %hfa34 %hfa34", hfa31, hfa34, hfa34, hfa34);
-
- myprintf("%hfa32 %hfa33 %hfa33 %hfa33 %hfa33",
- hfa32, hfa33, hfa33, hfa33, hfa33);
- myprintf("%hfa31 %hfa33 %hfa33 %hfa33 %hfa33",
- hfa31, hfa33, hfa33, hfa33, hfa33);
- myprintf("%hfa33 %hfa33 %hfa33 %hfa33",
- hfa33, hfa33, hfa33, hfa33);
-
- myprintf("%hfa34 %hfa32 %hfa32 %hfa32 %hfa32",
- hfa34, hfa32, hfa32, hfa32, hfa32);
- myprintf("%hfa33 %hfa32 %hfa32 %hfa32 %hfa32",
- hfa33, hfa32, hfa32, hfa32, hfa32);
-
- myprintf("%hfa34 %hfa32 %hfa31 %hfa31 %hfa31 %hfa31",
- hfa34, hfa32, hfa31, hfa31, hfa31, hfa31);
-
- myprintf("HFA double:");
- myprintf("%hfa24 %hfa24 %hfa24 %hfa24", hfa24, hfa24, hfa24, hfa24);
- myprintf("%hfa23 %hfa24 %hfa24 %hfa24", hfa23, hfa24, hfa24, hfa24);
- myprintf("%hfa22 %hfa24 %hfa24 %hfa24", hfa22, hfa24, hfa24, hfa24);
- myprintf("%hfa21 %hfa24 %hfa24 %hfa24", hfa21, hfa24, hfa24, hfa24);
-
- myprintf("%hfa22 %hfa23 %hfa23 %hfa23 %hfa23",
- hfa22, hfa23, hfa23, hfa23, hfa23);
- myprintf("%hfa21 %hfa23 %hfa23 %hfa23 %hfa23",
- hfa21, hfa23, hfa23, hfa23, hfa23);
- myprintf("%hfa23 %hfa23 %hfa23 %hfa23",
- hfa23, hfa23, hfa23, hfa23);
-
- myprintf("%hfa24 %hfa22 %hfa22 %hfa22 %hfa22",
- hfa24, hfa22, hfa22, hfa22, hfa22);
- myprintf("%hfa23 %hfa22 %hfa22 %hfa22 %hfa22",
- hfa23, hfa22, hfa22, hfa22, hfa22);
-
- myprintf("%hfa24 %hfa22 %hfa21 %hfa21 %hfa21 %hfa21",
- hfa24, hfa22, hfa21, hfa21, hfa21, hfa21);
-
- myprintf("HFA float:");
- myprintf("%hfa14 %hfa14 %hfa14 %hfa14", hfa14, hfa14, hfa14, hfa14);
- myprintf("%hfa13 %hfa14 %hfa14 %hfa14", hfa13, hfa14, hfa14, hfa14);
- myprintf("%hfa12 %hfa14 %hfa14 %hfa14", hfa12, hfa14, hfa14, hfa14);
- myprintf("%hfa11 %hfa14 %hfa14 %hfa14", hfa11, hfa14, hfa14, hfa14);
-
- myprintf("%hfa12 %hfa13 %hfa13 %hfa13 %hfa13",
- hfa12, hfa13, hfa13, hfa13, hfa13);
- myprintf("%hfa11 %hfa13 %hfa13 %hfa13 %hfa13",
- hfa11, hfa13, hfa13, hfa13, hfa13);
- myprintf("%hfa13 %hfa13 %hfa13 %hfa13",
- hfa13, hfa13, hfa13, hfa13);
-
- myprintf("%hfa14 %hfa12 %hfa12 %hfa12 %hfa12",
- hfa14, hfa12, hfa12, hfa12, hfa12);
- myprintf("%hfa13 %hfa12 %hfa12 %hfa12 %hfa12",
- hfa13, hfa12, hfa12, hfa12, hfa12);
-
- myprintf("%hfa14 %hfa12 %hfa11 %hfa11 %hfa11 %hfa11",
- hfa14, hfa12, hfa11, hfa11, hfa11, hfa11);
-}
-
-void pll(unsigned long long x)
-{
- printf("%llx\n", x);
-}
-
-void movi(void)
-{
- printf("MOVI:\n");
- pll(0);
- pll(0xabcd);
- pll(0xabcd0000);
- pll(0xabcd00000000);
- pll(0xabcd000000000000);
- pll(0xffffabcd);
- pll(0xabcdffff);
- pll(0xffffffffffffabcd);
- pll(0xffffffffabcdffff);
- pll(0xffffabcdffffffff);
- pll(0xabcdffffffffffff);
- pll(0xaaaaaaaa);
- pll(0x5555555555555555);
- pll(0x77777777);
- pll(0x3333333333333333);
- pll(0xf8f8f8f8);
- pll(0x1e1e1e1e1e1e1e1e);
- pll(0x3f803f80);
- pll(0x01ff01ff01ff01ff);
- pll(0x007fffc0);
- pll(0x03fff80003fff800);
- pll(0x0007fffffffffe00);
-
- pll(0xabcd1234);
- pll(0xabcd00001234);
- pll(0xabcd000000001234);
- pll(0xabcd12340000);
- pll(0xabcd000012340000);
- pll(0xabcd123400000000);
- pll(0xffffffffabcd1234);
- pll(0xffffabcdffff1234);
- pll(0xabcdffffffff1234);
- pll(0xffffabcd1234ffff);
- pll(0xabcdffff1234ffff);
- pll(0xabcd1234ffffffff);
-
- pll(0xffffef0123456789);
- pll(0xabcdef012345ffff);
-
- pll(0xabcdef0123456789);
-}
-
-static uint32_t addip0(uint32_t x) { return x + 0; }
-static uint64_t sublp0(uint64_t x) { return x - 0; }
-static uint32_t addip123(uint32_t x) { return x + 123; }
-static uint64_t addlm123(uint64_t x) { return x + -123; }
-static uint64_t sublp4095(uint64_t x) { return x - 4095; }
-static uint32_t subim503808(uint32_t x) { return x - -503808; }
-static uint64_t addp12345(uint64_t x) { return x + 12345; }
-static uint32_t subp12345(uint32_t x) { return x - 12345; }
-
-static uint32_t mvni(uint32_t x) { return 0xffffffff - x; }
-static uint64_t negl(uint64_t x) { return 0 - x; }
-static uint32_t rsbi123(uint32_t x) { return 123 - x; }
-static uint64_t rsbl123(uint64_t x) { return 123 - x; }
-
-static uint32_t andi0(uint32_t x) { return x & 0; }
-static uint64_t andlm1(uint64_t x) { return x & -1; }
-static uint64_t orrl0(uint64_t x) { return x | 0; }
-static uint32_t orrim1(uint32_t x) { return x | -1; }
-static uint32_t eori0(uint32_t x) { return x ^ 0; }
-static uint64_t eorlm1(uint64_t x) { return x ^ -1; }
-static uint32_t and0xf0(uint32_t x) { return x & 0xf0; }
-static uint64_t orr0xf0(uint64_t x) { return x | 0xf0; }
-static uint64_t eor0xf0(uint64_t x) { return x ^ 0xf0; }
-
-static uint32_t lsli0(uint32_t x) { return x << 0; }
-static uint32_t lsri0(uint32_t x) { return x >> 0; }
-static int64_t asrl0(int64_t x) { return x >> 0; }
-static uint32_t lsli1(uint32_t x) { return x << 1; }
-static uint32_t lsli31(uint32_t x) { return x << 31; }
-static uint64_t lsll1(uint64_t x) { return x << 1; }
-static uint64_t lsll63(uint64_t x) { return x << 63; }
-static uint32_t lsri1(uint32_t x) { return x >> 1; }
-static uint32_t lsri31(uint32_t x) { return x >> 31; }
-static uint64_t lsrl1(uint64_t x) { return x >> 1; }
-static uint64_t lsrl63(uint64_t x) { return x >> 63; }
-static int32_t asri1(int32_t x) { return x >> 1; }
-static int32_t asri31(int32_t x) { return x >> 31; }
-static int64_t asrl1(int64_t x) { return x >> 1; }
-static int64_t asrl63(int64_t x) { return x >> 63; }
-
-void opi(void)
-{
- int x = 1000;
- pll(addip0(x));
- pll(sublp0(x));
- pll(addip123(x));
- pll(addlm123(x));
- pll(sublp4095(x));
- pll(subim503808(x));
- pll(addp12345(x));
- pll(subp12345(x));
- pll(mvni(x));
- pll(negl(x));
- pll(rsbi123(x));
- pll(rsbl123(x));
- pll(andi0(x));
- pll(andlm1(x));
- pll(orrl0(x));
- pll(orrim1(x));
- pll(eori0(x));
- pll(eorlm1(x));
- pll(and0xf0(x));
- pll(orr0xf0(x));
- pll(eor0xf0(x));
- pll(lsli0(x));
- pll(lsri0(x));
- pll(asrl0(x));
- pll(lsli1(x));
- pll(lsli31(x));
- pll(lsll1(x));
- pll(lsll63(x));
- pll(lsri1(x));
- pll(lsri31(x));
- pll(lsrl1(x));
- pll(lsrl63(x));
- pll(asri1(x));
- pll(asri31(x));
- pll(asrl1(x));
- pll(asrl63(x));
-}
-
-void pcs(void)
-{
- arg();
- ret();
- stdarg();
- movi();
- opi();
-}
-
-int main()
-{
- pcs();
- return 0;
-}
+++ /dev/null
-Arguments:
-0
-12
-345
-6789
-abcde
-fghijk
-lmnopqr
-stuvwxyz
-ABCDEFGHI
-JKLMNOPQRS
-TUVWXYZ0123
-456789abcdef
-ghijklmnopqrs
-tuvwxyzABCDEFG
-HIJKLMNOPQRSTUV
-WXYZ0123456789ab
-cdefghijklmnopqrs
-11.1
-12.1 12.1
-13.1 13.2 13.3
-14.1 14.2 14.3 14.4
-21.1
-22.1 22.1
-23.1 23.2 23.3
-24.1 24.2 24.3 24.4
-31.1
-32.1 32.1
-33.1 33.2 33.3
-34.1 34.2 34.3 34.4
-stu ABC JKL TUV 456 ghi
-ABC JKL TUV 456 ghi tuv
-14.1 14.4 23.1 23.3 32.1 32.2
-0 14.1 14.4 12 24.1 24.4 345 34.1 34.4
-Return values:
-0
-12
-345
-6789
-abcde
-fghijk
-lmnopqr
-stuvwxyz
-ABCDEFGHI
-JKLMNOPQRS
-TUVWXYZ0123
-456789abcdef
-ghijklmnopqrs
-tuvwxyzABCDEFG
-HIJKLMNOPQRSTUV
-WXYZ0123456789ab
-cdefghijklmnopqrs
-11.1
-12.1 12.2
-13.1 13.3
-14.1 14.4
-21.1
-22.1 22.2
-23.1 23.3
-24.1 24.4
-31.1
-32.1 32.2
-33.1 33.3
-34.1 34.4
-stdarg:
-ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI
-lmnopqr ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI ABCDEFGHI
-HFA long double:
-34.1,34.4 34.1,34.4 34.1,34.4 34.1,34.4
-33.1,33.3 34.1,34.4 34.1,34.4 34.1,34.4
-32.1,32.2 34.1,34.4 34.1,34.4 34.1,34.4
-31.1,31.1 34.1,34.4 34.1,34.4 34.1,34.4
-32.1,32.2 33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
-31.1,31.1 33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
-33.1,33.3 33.1,33.3 33.1,33.3 33.1,33.3
-34.1,34.4 32.1,32.2 32.1,32.2 32.1,32.2 32.1,32.2
-33.1,33.3 32.1,32.2 32.1,32.2 32.1,32.2 32.1,32.2
-34.1,34.4 32.1,32.2 31.1,31.1 31.1,31.1 31.1,31.1 31.1,31.1
-HFA double:
-24.1,24.4 24.1,24.4 24.1,24.4 24.1,24.4
-23.1,23.3 24.1,24.4 24.1,24.4 24.1,24.4
-22.1,22.2 24.1,24.4 24.1,24.4 24.1,24.4
-21.1,21.1 24.1,24.4 24.1,24.4 24.1,24.4
-22.1,22.2 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
-21.1,21.1 23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
-23.1,23.3 23.1,23.3 23.1,23.3 23.1,23.3
-24.1,24.4 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
-23.1,23.3 22.1,22.2 22.1,22.2 22.1,22.2 22.1,22.2
-24.1,24.4 22.1,22.2 21.1,21.1 21.1,21.1 21.1,21.1 21.1,21.1
-HFA float:
-14.1,14.4 14.1,14.4 14.1,14.4 14.1,14.4
-13.1,13.3 14.1,14.4 14.1,14.4 14.1,14.4
-12.1,12.2 14.1,14.4 14.1,14.4 14.1,14.4
-11.1,11.1 14.1,14.4 14.1,14.4 14.1,14.4
-12.1,12.2 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
-11.1,11.1 13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
-13.1,13.3 13.1,13.3 13.1,13.3 13.1,13.3
-14.1,14.4 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
-13.1,13.3 12.1,12.2 12.1,12.2 12.1,12.2 12.1,12.2
-14.1,14.4 12.1,12.2 11.1,11.1 11.1,11.1 11.1,11.1 11.1,11.1
-MOVI:
-0
-abcd
-abcd0000
-abcd00000000
-abcd000000000000
-ffffabcd
-abcdffff
-ffffffffffffabcd
-ffffffffabcdffff
-ffffabcdffffffff
-abcdffffffffffff
-aaaaaaaa
-5555555555555555
-77777777
-3333333333333333
-f8f8f8f8
-1e1e1e1e1e1e1e1e
-3f803f80
-1ff01ff01ff01ff
-7fffc0
-3fff80003fff800
-7fffffffffe00
-abcd1234
-abcd00001234
-abcd000000001234
-abcd12340000
-abcd000012340000
-abcd123400000000
-ffffffffabcd1234
-ffffabcdffff1234
-abcdffffffff1234
-ffffabcd1234ffff
-abcdffff1234ffff
-abcd1234ffffffff
-ffffef0123456789
-abcdef012345ffff
-abcdef0123456789
-3e8
-3e8
-463
-36d
-fffffffffffff3e9
-7b3e8
-3421
-ffffd3af
-fffffc17
-fffffffffffffc18
-fffffc93
-fffffffffffffc93
-0
-3e8
-3e8
-ffffffff
-3e8
-fffffffffffffc17
-e0
-3f8
-318
-3e8
-3e8
-3e8
-7d0
-0
-7d0
-0
-1f4
-0
-1f4
-0
-1f4
-0
-1f4
-0
+++ /dev/null
-int i = i++;
+++ /dev/null
-74_nocode_wanted.c:1: error: initializer element is not constant
+++ /dev/null
-#include <stdio.h>
-
-/* This test is a snippet from the J interpreter */
-
-typedef long I;
-typedef struct{I c[4];I b,e,k;} PT;
-
-PT cases[] = {
- ((I)4194304L +(I)2097152L +(I)67108864L), (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), -1L, 1,2,1,
- ((I)+4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L, (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 2,3,2,
- ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)262144L, (((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 1,3,2,
- ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)524288L, -1L, 1,2,1,
- ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)1048576L, (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), 1,3,1,
- ((I)4194304L +(I)2097152L +(I)67108864L)+( (I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)262144L, (I)262144L, 1,3,1,
- ((I)4194304L +(I)2097152L +(I)67108864L), ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), -1L, 1,2,1,
- (I)33554432L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L), (I)2097152L, ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), -1L, 0,2,1,
- (I)67108864L, ((I)1048576L +(I)524288L +(I)262144L +(((I)1L +(I)256L +(I)4L +(I)8L +(I)16L +(I)64L +(I)128L +(I)268435456L +(I)536870912L +(I)1024L +(I)4096L +(I)8192L +(I)16384L)+((I)2L +(I)131072L +(I)2048L)+(I)32L +(I)32768L +(I)65536L)), (I)134217728L, -1L, 0,2,0,
-};
-
-int main() {
- int i, j;
-
- for(j=0; j < sizeof(cases)/sizeof(cases[0]); j++) {
- for(i=0; i < sizeof(cases->c)/sizeof(cases->c[0]); i++)
- printf("cases[%d].c[%d]=%ld\n", j, i, cases[j].c[i]);
-
- printf("cases[%d].b=%ld\n", j, cases[j].b);
- printf("cases[%d].e=%ld\n", j, cases[j].e);
- printf("cases[%d].k=%ld\n", j, cases[j].k);
- printf("\n");
- }
- return 0;
-}
+++ /dev/null
-cases[0].c[0]=73400320
-cases[0].c[1]=262144
-cases[0].c[2]=805567999
-cases[0].c[3]=-1
-cases[0].b=1
-cases[0].e=2
-cases[0].k=1
-
-cases[1].c[0]=879754751
-cases[1].c[1]=262144
-cases[1].c[2]=262144
-cases[1].c[3]=805567999
-cases[1].b=2
-cases[1].e=3
-cases[1].k=2
-
-cases[2].c[0]=879754751
-cases[2].c[1]=805567999
-cases[2].c[2]=262144
-cases[2].c[3]=805567999
-cases[2].b=1
-cases[2].e=3
-cases[2].k=2
-
-cases[3].c[0]=879754751
-cases[3].c[1]=805830143
-cases[3].c[2]=524288
-cases[3].c[3]=-1
-cases[3].b=1
-cases[3].e=2
-cases[3].k=1
-
-cases[4].c[0]=879754751
-cases[4].c[1]=805830143
-cases[4].c[2]=1048576
-cases[4].c[3]=805830143
-cases[4].b=1
-cases[4].e=3
-cases[4].k=1
-
-cases[5].c[0]=879754751
-cases[5].c[1]=805830143
-cases[5].c[2]=262144
-cases[5].c[3]=262144
-cases[5].b=1
-cases[5].e=3
-cases[5].k=1
-
-cases[6].c[0]=73400320
-cases[6].c[1]=807403007
-cases[6].c[2]=807403007
-cases[6].c[3]=-1
-cases[6].b=1
-cases[6].e=2
-cases[6].k=1
-
-cases[7].c[0]=839122431
-cases[7].c[1]=2097152
-cases[7].c[2]=807403007
-cases[7].c[3]=-1
-cases[7].b=0
-cases[7].e=2
-cases[7].k=1
-
-cases[8].c[0]=67108864
-cases[8].c[1]=807403007
-cases[8].c[2]=134217728
-cases[8].c[3]=-1
-cases[8].b=0
-cases[8].e=2
-cases[8].k=0
-
+++ /dev/null
-#include <stdio.h>
-
-#define $(x) x
-#define $fred 10
-#define joe$ 20
-#define hen$y 30
-
-#define $10(x) x*10
-#define _$10(x) x/10
-
-int main()
-{
- printf("fred=%d\n", $fred);
- printf("joe=%d\n", joe$);
- printf("henry=%d\n", hen$y);
-
- printf("fred2=%d\n", $($fred));
- printf("joe2=%d\n", $(joe$));
- printf("henry2=%d\n", $(hen$y));
-
- printf("fred10=%d\n", $10($fred));
- printf("joe_10=%d\n", _$10(joe$));
-
- int $ = 10;
- int a100$ = 100;
- int a$$ = 1000;
- int a$c$b = 2121;
- int $100 = 10000;
- const char *$$$ = "money";
-
- printf("local=%d\n", $);
- printf("a100$=%d\n", a100$);
- printf("a$$=%d\n", a$$);
- printf("a$c$b=%d\n", a$c$b);
- printf("$100=%d\n", $100);
- printf("$$$=%s", $$$);
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/
+++ /dev/null
-fred=10
-joe=20
-henry=30
-fred2=10
-joe2=20
-henry2=30
-fred10=100
-joe_10=2
-local=10
-a100$=100
-a$$=1000
-a$c$b=2121
-$100=10000
-$$$=money
+++ /dev/null
-#include <stdio.h>
-
-int main()
-{
- /* must not affect how #pragma ppop_macro works */
- #define pop_macro foobar1
-
- /* must not affect how #pragma push_macro works */
- #define push_macro foobar2
-
- #undef abort
- #define abort "111"
- printf("abort = %s\n", abort);
-
- #pragma push_macro("abort")
- #undef abort
- #define abort "222"
- printf("abort = %s\n", abort);
-
- #pragma push_macro("abort")
- #undef abort
- #define abort "333"
- printf("abort = %s\n", abort);
-
- #pragma pop_macro("abort")
- printf("abort = %s\n", abort);
-
- #pragma pop_macro("abort")
- printf("abort = %s\n", abort);
-}
+++ /dev/null
-abort = 111
-abort = 222
-abort = 333
-abort = 222
-abort = 111
+++ /dev/null
-#include <stdio.h>
-
-/* This test segfaults as of April 27, 2015. */
-void f1(int argc)
-{
- char test[argc];
- if(0)
- label:
- printf("boom!\n");
- if(argc-- == 0)
- return;
- goto label;
-}
-
-/* This segfaulted on 2015-11-19. */
-void f2(void)
-{
- goto start;
- {
- int a[1 && 1]; /* not a variable-length array */
- int b[1 || 1]; /* not a variable-length array */
- int c[1 ? 1 : 1]; /* not a variable-length array */
- start:
- a[0] = 0;
- b[0] = 0;
- c[0] = 0;
- }
-}
-
-void f3(void)
-{
- printf("%d\n", 0 ? printf("x1\n") : 11);
- printf("%d\n", 1 ? 12 : printf("x2\n"));
- printf("%d\n", 0 && printf("x3\n"));
- printf("%d\n", 1 || printf("x4\n"));
-}
-
-int main()
-{
- f1(2);
- f2();
- f3();
-
- return 0;
-}
+++ /dev/null
-boom!
-boom!
-11
-12
-0
-1
+++ /dev/null
-#include <stdio.h>
-
-int f(void)
-{
- return 5;
-}
-
-void test1()
-{
- int count = 10;
- void *addr[10];
- for(;count--;) {
- int a[f()];
-
- addr[count] = a;
-
- continue;
- }
-
- if(addr[9] == addr[0]) {
- printf("OK\n");
- } else {
- printf("NOT OK\n");
- }
-}
-
-void test2()
-{
- int count = 10;
- void *addr[count];
- for(;count--;) {
- int a[f()];
-
- addr[count] = a;
-
- continue;
- }
-
- if(addr[9] == addr[0]) {
- printf("OK\n");
- } else {
- printf("NOT OK\n");
- }
-}
-
-void test3()
-{
- int count = 10;
- void *addr[count];
- while(count--) {
- int a[f()];
-
- addr[count] = a;
-
- continue;
- }
-
- if(addr[9] == addr[0]) {
- printf("OK\n");
- } else {
- printf("NOT OK\n");
- }
-}
-
-void test4()
-{
- int count = 10;
- void *addr[count];
- do {
- int a[f()];
-
- addr[--count] = a;
-
- continue;
- } while (count);
-
- if(addr[9] == addr[0]) {
- printf("OK\n");
- } else {
- printf("NOT OK\n");
- }
-}
-
-void test5()
-{
- int count = 10;
- int a[f()];
- int c[f()];
-
- c[0] = 42;
-
- for(;count--;) {
- int b[f()];
- int i;
- for (i=0; i<f(); i++) {
- b[i] = count;
- }
- }
-
- if (c[0] == 42) {
- printf("OK\n");
- } else {
- printf("NOT OK\n");
- }
-}
-
-int main(void)
-{
- test1();
- test2();
- test3();
- test4();
- test5();
-
- return 0;
-}
+++ /dev/null
-OK
-OK
-OK
-OK
-OK
+++ /dev/null
-#include <stdio.h>
-struct wchar {
- char *data; char mem[];
-};
-struct wint {
- char *data; int mem[];
-};
-int f1char (void) {
- char s[9]="nonono";
- struct wchar q = {"bugs"};
- return !s[0];
-}
-int f1int (void) {
- char s[9]="nonono";
- struct wint q = {"bugs"};
- return !s[0];
-}
-int main (void) {
- char s[9]="nonono";
- static struct wchar q = {"bugs", {'c'}};
- //printf ("tcc has %s %s\n", s, q.data);
- if (f1char() || f1int())
- printf ("bla\n");
- return !s[0];
-}
+++ /dev/null
-/* The following are all valid decls, even though some subtypes
- are incomplete. */
-enum E *e;
-const enum E *e1;
-enum E const *e2;
-struct S *s;
-const struct S *s1;
-struct S const *s2;
-
-/* Various strangely looking declarators, which are all valid
- and have to map to the same numbered typedefs. */
-typedef int (*fptr1)();
-int f1 (int (), int);
-typedef int (*fptr2)(int x);
-int f2 (int (int x), int);
-typedef int (*fptr3)(int);
-int f3 (int (int), int);
-typedef int (*fptr4[4])(int);
-int f4 (int (*[4])(int), int);
-typedef int (*fptr5)(fptr1);
-int f5 (int (int()), fptr1);
-int f1 (fptr1 fp, int i)
-{
- return (*fp)(i);
-}
-int f2 (fptr2 fp, int i)
-{
- return (*fp)(i);
-}
-int f3 (fptr3 fp, int i)
-{
- return (*fp)(i);
-}
-int f4 (fptr4 fp, int i)
-{
- return (*fp[i])(i);
-}
-int f5 (fptr5 fp, fptr1 i)
-{
- return fp(i);
-}
-int f8 (int ([4]), int);
-int main () { return 0; }
+++ /dev/null
-typedef unsigned short uint16_t;
-typedef unsigned char uint8_t;
-
-typedef union Unaligned16a {
- uint16_t u;
- uint8_t b[2];
-} __attribute__((packed)) Unaligned16a;
-
-typedef union __attribute__((packed)) Unaligned16b {
- uint16_t u;
- uint8_t b[2];
-} Unaligned16b;
-
-int main () { return 0; }
+++ /dev/null
-#include <stdio.h>
-double привет=0.1;
-int Lefèvre=2;
-int main(){
- printf("привет=%g\n",привет);
- printf("Lefèvre=%d\n",Lefèvre);
- return 0;
-}
-// pcc & tcc only
+++ /dev/null
-привет=0.1
-Lefèvre=2
+++ /dev/null
-extern int printf(const char *format, ...);
-
-#define ACPI_TYPE_INVALID 0x1E
-#define NUM_NS_TYPES ACPI_TYPE_INVALID+1
-int array[NUM_NS_TYPES];
-
-#define n 0xe
-int main()
-{
- printf("n+1 = %d\n", n+1);
-// printf("n+1 = %d\n", 0xe+1);
-}
+++ /dev/null
-extern int printf (const char *, ...);
-extern void vide(void);
-__asm__("vide: ret");
-
-int main() {
- vide();
- printf ("okay\n");
- return 0;
-}
+++ /dev/null
-#include <stdio.h>
-
-int
-main()
-{
-#if defined(__LLP64__)
- if (sizeof(short) == 2
- && sizeof(int) == 4
- && sizeof(long int) == 4
- && sizeof(long long int) == 8
- && sizeof(void*) == 8) {
- (void)printf("Ok\n");
- } else {
- (void)printf("KO __LLP64__\n");
- }
-#elif defined(__LP64__)
- if (sizeof(short) == 2
- && sizeof(int) == 4
- && sizeof(long int) == 8
- && sizeof(long long int) == 8
- && sizeof(void*) == 8) {
- (void)printf("Ok\n");
- } else {
- (void)printf("KO __LP64__\n");
- }
-#elif defined(__ILP32__)
- if (sizeof(short) == 2
- && sizeof(int) == 4
- && sizeof(long int) == 4
- && sizeof(void*) == 4) {
- (void)printf("Ok\n");
- } else {
- (void)printf("KO __ILP32__\n");
- }
-#else
- (void)printf("KO no __*LP*__ defined.\n");
-#endif
-}
+++ /dev/null
-/* This checks various ways of dead code inside if statements
- where there are non-obvious ways of how the code is actually
- not dead due to reachable by labels. */
-extern int printf (const char *, ...);
-static void kb_wait_1(void)
-{
- unsigned long timeout = 2;
- do {
- /* Here the else arm is a statement expression that's supposed
- to be suppressed. The label inside the while would unsuppress
- code generation again if not handled correctly. And that
- would wreak havok to the cond-expression because there's no
- jump-around emitted, the whole statement expression really
- needs to not generate code (perhaps except useless forward jumps). */
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- int i = 1;
- while (1)
- while (i--)
- some_label:
- printf("error\n");
- goto some_label;
- })
- );
- timeout--;
- } while (timeout);
-}
-int main (void)
-{
- int i = 1;
- kb_wait_1();
-
- /* Simple test of dead code at first sight which isn't actually dead. */
- if (0) {
-yeah:
- printf ("yeah\n");
- } else {
- printf ("boo\n");
- }
- if (i--)
- goto yeah;
-
- /* Some more non-obvious uses where the problems are loops, so that even
- the first loop statements aren't actually dead. */
- i = 1;
- if (0) {
- while (i--) {
- printf ("once\n");
-enterloop:
- printf ("twice\n");
- }
- }
- if (i >= 0)
- goto enterloop;
-
- /* The same with statement expressions. One might be tempted to
- handle them specially by counting if inside statement exprs and
- not unsuppressing code at loops at all then.
- See kb_wait_1 for the other side of the medal where that wouldn't work. */
- i = ({
- int j = 1;
- if (0) {
- while (j--) {
- printf ("SEonce\n");
- enterexprloop:
- printf ("SEtwice\n");
- }
- }
- if (j >= 0)
- goto enterexprloop;
- j; });
-
- /* The other two loop forms: */
- i = 1;
- if (0) {
- for (i = 1; i--;) {
- printf ("once2\n");
-enterloop2:
- printf ("twice2\n");
- }
- }
- if (i > 0)
- goto enterloop2;
-
- i = 1;
- if (0) {
- do {
- printf ("once3\n");
-enterloop3:
- printf ("twice3\n");
- } while (i--);
- }
- if (i > 0)
- goto enterloop3;
-
- /* And check that case and default labels have the same effect
- of disabling code suppression. */
- i = 41;
- switch (i) {
- if (0) {
- printf ("error\n");
- case 42:
- printf ("error2\n");
- case 41:
- printf ("caseok\n");
- }
- }
-
- i = 41;
- switch (i) {
- if (0) {
- printf ("error3\n");
- default:
- printf ("caseok2\n");
- break;
- case 42:
- printf ("error4\n");
- }
- }
- return 0;
-}
+++ /dev/null
-timeout=2
-timeout=1
-boo
-yeah
-twice
-once
-twice
-SEtwice
-SEonce
-SEtwice
-twice2
-once2
-twice2
-twice3
-once3
-twice3
-caseok
-caseok2
+++ /dev/null
-/* Check some way in where code suppression caused various
- miscompilations. */
-extern int printf (const char *, ...);
-typedef unsigned long size_t;
-
-size_t _brk_start, _brk_end;
-void * extend_brk(size_t size, size_t align)
-{
- size_t mask = align - 1;
- void *ret = 0;
-
- do {
- if (__builtin_expect(!!(_brk_start == 0), 0))
- do {
- printf("wrong1\n");
- } while (0);
- } while (0);
- _brk_end = (_brk_end + mask) & ~mask;
- ret = (void *)_brk_end;
- _brk_end += size;
-
- return ret;
-}
-
-static void get_args (int a, int b)
-{
- if (a != 1)
- printf("wrong2\n");
- else
- printf("okay\n");
-}
-
-void bla(void)
-{
- int __ret = 42;
- ({
- if (__builtin_expect(!!(0), 0)) {
- if (__builtin_expect(!!__ret, 0))
- printf("wrong3\n");
- int x = !!(__ret);
- }
- __ret;
- });
- get_args(!!__ret, sizeof(__ret));
-}
-
-_Bool chk(unsigned long addr, unsigned long limit, unsigned long size)
-{
- _Bool ret;
- /* This just needs to compile, no runtime test. (And it doesn't compile
- only with certain internal checking added that's not committed). */
- if (0)
- ret = 0 != (!!(addr > limit - size));
-}
-
-int main()
-{
- void *r;
- _brk_start = 1024;
- _brk_end = 1024;
- r = extend_brk (4096, 16);
- if (!r)
- printf("wrong4\n");
- else
- printf("okay\n");
- bla();
- return 0;
-}
+++ /dev/null
-okay
-okay
+++ /dev/null
-extern int printf(const char *format, ...);
-static void kb_wait_1(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- while (1)
- printf("error\n");
- })
- );
- timeout--;
- } while (timeout);
-}
-static void kb_wait_2(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- for (;;)
- printf("error\n");
- })
- );
- timeout--;
- } while (timeout);
-}
-static void kb_wait_2_1(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- do {
- printf("error\n");
- } while (1);
- })
- );
- timeout--;
- } while (timeout);
-}
-static void kb_wait_2_2(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- label:
- printf("error\n");
- goto label;
- })
- );
- timeout--;
- } while (timeout);
-}
-static void kb_wait_3(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- int i = 1;
- goto label;
- i = i + 2;
- label:
- i = i + 3;
- })
- );
- timeout--;
- } while (timeout);
-}
-static void kb_wait_4(void)
-{
- unsigned long timeout = 2;
- do {
- (1 ?
- printf("timeout=%ld\n", timeout) :
- ({
- switch(timeout) {
- case 2:
- printf("timeout is 2");
- break;
- case 1:
- printf("timeout is 1");
- break;
- default:
- printf("timeout is 0?");
- break;
- };
- // return;
- })
- );
- timeout--;
- } while (timeout);
-}
-int main()
-{
- printf("begin\n");
- kb_wait_1();
- kb_wait_2();
- kb_wait_2_1();
- kb_wait_2_2();
- kb_wait_3();
- kb_wait_4();
- printf("end\n");
- return 0;
-}
+++ /dev/null
-begin
-timeout=2
-timeout=1
-timeout=2
-timeout=1
-timeout=2
-timeout=1
-timeout=2
-timeout=1
-timeout=2
-timeout=1
-timeout=2
-timeout=1
-end
+++ /dev/null
-typedef unsigned char u8;
-typedef struct {} empty_s;
-struct contains_empty {
- u8 a;
- empty_s empty;
- u8 b;
-};
-struct contains_empty ce = { { (1) }, (empty_s){}, 022, };
-/* The following decl of 'q' would demonstrate the TCC bug in init_putv when
- handling copying compound literals. (Compound literals
- aren't acceptable constant initializers in isoc99, but
- we accept them like gcc, except for this case)
-//char *q = (char *){ "trara" }; */
-struct SS {u8 a[3], b; };
-struct SS sinit16[] = { { 1 }, 2 };
-struct S
-{
- u8 a,b;
- u8 c[2];
-};
-
-struct T
-{
- u8 s[16];
- u8 a;
-};
-
-struct U
-{
- u8 a;
- struct S s;
- u8 b;
- struct T t;
-};
-
-struct V
-{
- struct S s;
- struct T t;
- u8 a;
-};
-
-struct W
-{
- struct V t;
- struct S s[];
-};
-
-struct S gs = ((struct S){1, 2, 3, 4});
-struct S gs2 = {1, 2, {3, 4}};
-struct T gt = {"hello", 42};
-struct U gu = {3, 5,6,7,8, 4, "huhu", 43};
-struct U gu2 = {3, {5,6,7,8}, 4, {"huhu", 43}};
-/* Optional braces around scalar initializers. Accepted, but with
- a warning. */
-struct U gu3 = { {3}, {5,6,7,8,}, 4, {"huhu", 43}};
-/* Many superfluous braces and leaving out one initializer for U.s.c[1] */
-struct U gu4 = { 3, {5,6,7,}, 5, { "bla", {44}} };
-/* Superfluous braces and useless parens around values */
-struct S gs3 = { (1), {(2)}, {(((3))), {4}}};
-/* Superfluous braces, and leaving out braces for V.t, plus cast */
-struct V gv = {{{3},4,{5,6}}, "haha", (u8)45, 46};
-/* Compund literal */
-struct V gv2 = {(struct S){7,8,{9,10}}, {"hihi", 47}, 48};
-/* Parens around compound literal */
-struct V gv3 = {((struct S){7,8,{9,10}}), {"hoho", 49}, 50};
-/* Initialization of a flex array member (warns in GCC) */
-struct W gw = {{1,2,3,4}, {1,2,3,4,5}};
-
-union UU {
- u8 a;
- u8 b;
-};
-struct SU {
- union UU u;
- u8 c;
-};
-struct SU gsu = {5,6};
-
-/* Unnamed struct/union members aren't ISO C, but it's a widely accepted
- extension. See below for further extensions to that under -fms-extension.*/
-union UV {
- struct {u8 a,b;};
- struct S s;
-};
-union UV guv = {{6,5}};
-union UV guv2 = {{.b = 7, .a = 8}};
-union UV guv3 = {.b = 8, .a = 7};
-
-/* Under -fms-extensions also the following is valid:
-union UV2 {
- struct Anon {u8 a,b;}; // unnamed member, but tagged struct, ...
- struct S s;
-};
-struct Anon gan = { 10, 11 }; // ... which makes it available here.
-union UV2 guv4 = {{4,3}}; // and the other inits from above as well
-*/
-
-struct in6_addr {
- union {
- u8 u6_addr8[16];
- unsigned short u6_addr16[8];
- } u;
-};
-struct flowi6 {
- struct in6_addr saddr, daddr;
-};
-struct pkthdr {
- struct in6_addr daddr, saddr;
-};
-struct pkthdr phdr = { { { 6,5,4,3 } }, { { 9,8,7,6 } } };
-
-struct Wrap {
- void *func;
-};
-int global;
-void inc_global (void)
-{
- global++;
-}
-
-struct Wrap global_wrap[] = {
- ((struct Wrap) {inc_global}),
- inc_global,
-};
-
-#include <stdio.h>
-void print_ (const char *name, const u8 *p, long size)
-{
- printf ("%s:", name);
- while (size--) {
- printf (" %x", *p++);
- }
- printf ("\n");
-}
-#define print(x) print_(#x, (u8*)&x, sizeof (x))
-#if 1
-void foo (struct W *w, struct pkthdr *phdr_)
-{
- struct S ls = {1, 2, 3, 4};
- struct S ls2 = {1, 2, {3, 4}};
- struct T lt = {"hello", 42};
- struct U lu = {3, 5,6,7,8, 4, "huhu", 43};
- struct U lu1 = {3, ls, 4, {"huhu", 43}};
- struct U lu2 = {3, (ls), 4, {"huhu", 43}};
- const struct S *pls = &ls;
- struct S ls21 = *pls;
- struct U lu22 = {3, *pls, 4, {"huhu", 43}};
- /* Incomplete bracing. */
- struct U lu21 = {3, ls, 4, "huhu", 43};
- /* Optional braces around scalar initializers. Accepted, but with
- a warning. */
- struct U lu3 = { 3, {5,6,7,8,}, 4, {"huhu", 43}};
- /* Many superfluous braces and leaving out one initializer for U.s.c[1] */
- struct U lu4 = { 3, {5,6,7,}, 5, { "bla", 44} };
- /* Superfluous braces and useless parens around values */
- struct S ls3 = { (1), (2), {(((3))), 4}};
- /* Superfluous braces, and leaving out braces for V.t, plus cast */
- struct V lv = {{3,4,{5,6}}, "haha", (u8)45, 46};
- /* Compund literal */
- struct V lv2 = {(struct S)w->t.s, {"hihi", 47}, 48};
- /* Parens around compound literal */
- struct V lv3 = {((struct S){7,8,{9,10}}), ((const struct W *)w)->t.t, 50};
- const struct pkthdr *phdr = phdr_;
- struct flowi6 flow = { .daddr = phdr->daddr, .saddr = phdr->saddr };
- int elt = 0x42;
- /* Range init, overlapping */
- struct T lt2 = { { [1 ... 5] = 9, [6 ... 10] = elt, [4 ... 7] = elt+1 }, 1 };
- print(ls);
- print(ls2);
- print(lt);
- print(lu);
- print(lu1);
- print(lu2);
- print(ls21);
- print(lu21);
- print(lu22);
- print(lu3);
- print(lu4);
- print(ls3);
- print(lv);
- print(lv2);
- print(lv3);
- print(lt2);
- print(flow);
-}
-#endif
-
-void test_compound_with_relocs (void)
-{
- struct Wrap local_wrap[] = {
- ((struct Wrap) {inc_global}),
- inc_global,
- };
- void (*p)(void);
- p = global_wrap[0].func; p();
- p = global_wrap[1].func; p();
- p = local_wrap[0].func; p();
- p = local_wrap[1].func; p();
-}
-
-void sys_ni(void) { printf("ni\n"); }
-void sys_one(void) { printf("one\n"); }
-void sys_two(void) { printf("two\n"); }
-void sys_three(void) { printf("three\n"); }
-typedef void (*fptr)(void);
-const fptr table[3] = {
- [0 ... 2] = &sys_ni,
- [0] = sys_one,
- [1] = sys_two,
- [2] = sys_three,
-};
-
-void test_multi_relocs(void)
-{
- int i;
- for (i = 0; i < sizeof(table)/sizeof(table[0]); i++)
- table[i]();
-}
-\f
-/* Following is from GCC gcc.c-torture/execute/20050613-1.c. */
-
-struct SEA { int i; int j; int k; int l; };
-struct SEB { struct SEA a; int r[1]; };
-struct SEC { struct SEA a; int r[0]; };
-struct SED { struct SEA a; int r[]; };
-
-static void
-test_correct_filling (struct SEA *x)
-{
- static int i;
- if (x->i != 0 || x->j != 5 || x->k != 0 || x->l != 0)
- printf("sea_fill%d: wrong\n", i);
- else
- printf("sea_fill%d: okay\n", i);
- i++;
-}
-
-int
-test_zero_init (void)
-{
- /* The peculiarity here is that only a.j is initialized. That
- means that all other members must be zero initialized. TCC
- once didn't do that for sub-level designators. */
- struct SEB b = { .a.j = 5 };
- struct SEC c = { .a.j = 5 };
- struct SED d = { .a.j = 5 };
- test_correct_filling (&b.a);
- test_correct_filling (&c.a);
- test_correct_filling (&d.a);
- return 0;
-}
-\f
-int main()
-{
- print(ce);
- print(gs);
- print(gs2);
- print(gt);
- print(gu);
- print(gu2);
- print(gu3);
- print(gu4);
- print(gs3);
- print(gv);
- print(gv2);
- print(gv3);
- print(sinit16);
- print(gw);
- print(gsu);
- print(guv);
- print(guv.b);
- print(guv2);
- print(guv3);
- print(phdr);
- foo(&gw, &phdr);
- //printf("q: %s\n", q);
- test_compound_with_relocs();
- test_multi_relocs();
- test_zero_init();
- return 0;
-}
+++ /dev/null
-ce: 1 12
-gs: 1 2 3 4
-gs2: 1 2 3 4
-gt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a
-gu: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-gu2: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-gu3: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-gu4: 3 5 6 7 0 5 62 6c 61 0 0 0 0 0 0 0 0 0 0 0 0 0 2c
-gs3: 1 2 3 4
-gv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
-gv2: 7 8 9 a 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
-gv3: 7 8 9 a 68 6f 68 6f 0 0 0 0 0 0 0 0 0 0 0 0 31 32
-sinit16: 1 0 0 0 2 0 0 0
-gw: 1 2 3 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
-gsu: 5 6
-guv: 6 5 0 0
-guv.b: 5
-guv2: 8 7 0 0
-guv3: 7 8 0 0
-phdr: 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 0 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0
-ls: 1 2 3 4
-ls2: 1 2 3 4
-lt: 68 65 6c 6c 6f 0 0 0 0 0 0 0 0 0 0 0 2a
-lu: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-lu1: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-lu2: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-ls21: 1 2 3 4
-lu21: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-lu22: 3 1 2 3 4 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-lu3: 3 5 6 7 8 4 68 75 68 75 0 0 0 0 0 0 0 0 0 0 0 0 2b
-lu4: 3 5 6 7 0 5 62 6c 61 0 0 0 0 0 0 0 0 0 0 0 0 0 2c
-ls3: 1 2 3 4
-lv: 3 4 5 6 68 61 68 61 0 0 0 0 0 0 0 0 0 0 0 0 2d 2e
-lv2: 1 2 3 4 68 69 68 69 0 0 0 0 0 0 0 0 0 0 0 0 2f 30
-lv3: 7 8 9 a 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 32
-lt2: 0 9 9 9 43 43 43 43 42 42 42 0 0 0 0 0 1
-flow: 9 8 7 6 0 0 0 0 0 0 0 0 0 0 0 0 6 5 4 3 0 0 0 0 0 0 0 0 0 0 0 0
-one
-two
-three
-sea_fill0: okay
-sea_fill1: okay
-sea_fill2: okay
+++ /dev/null
-int printf(const char *, ...);
-char t[] = "012345678";
-
-int main(void)
-{
- char *data = t;
- unsigned long long r = 4;
- unsigned a = 5;
- unsigned long long b = 12;
-
- *(unsigned*)(data + r) += a - b;
-
- printf("data = \"%s\"\n", data);
- return 0;
-}
+++ /dev/null
-data = "0123-5678"
+++ /dev/null
-/* This checks if enums needing 8 bit but only having positive
- values are correctly zero extended (instead of sign extended)
- when stored into/loaded from a 8 bit bit-field of enum type (which
- itself is implementation defined, so isn't necessarily supported by all
- other compilers). */
-enum tree_code {
- SOME_CODE = 148, /* has bit 7 set, and hence all further enum values as well */
- LAST_AND_UNUSED_TREE_CODE
-};
-typedef union tree_node *tree;
-struct tree_common
-{
- union tree_node *chain;
- union tree_node *type;
- enum tree_code code : 8;
- unsigned side_effects_flag : 1;
-};
-union tree_node
-{
- struct tree_common common;
- };
-enum c_tree_code {
- C_DUMMY_TREE_CODE = LAST_AND_UNUSED_TREE_CODE,
- STMT_EXPR,
- LAST_C_TREE_CODE
-};
-enum cplus_tree_code {
- CP_DUMMY_TREE_CODE = LAST_C_TREE_CODE,
- AMBIG_CONV,
- LAST_CPLUS_TREE_CODE
-};
-
-extern int printf(const char *, ...);
-int blah(){return 0;}
-
-int convert_like_real (tree convs)
-{
- switch (((enum tree_code) (convs)->common.code))
- {
- case AMBIG_CONV: /* This has bit 7 set, which must not be the sign
- bit in tree_common.code, i.e. the bitfield must
- be somehow marked unsigned. */
- return blah();
- default:
- break;
- };
- printf("unsigned enum bit-fields broken\n");
-}
-
-int main()
-{
- union tree_node convs;
-
- convs.common.code = AMBIG_CONV;
- convert_like_real (&convs);
- return 0;
-}
+++ /dev/null
-/* integer promotion */
-
-int printf(const char*, ...);
-#define promote(s) printf(" %ssigned : %s\n", (s) - 100 < 0 ? " " : "un", #s);
-
-int main (void)
-{
- struct {
- unsigned ub:3;
- unsigned u:32;
- unsigned long long ullb:35;
- unsigned long long ull:64;
- unsigned char c;
- } s = { 1, 1, 1 };
-
- promote(s.ub);
- promote(s.u);
- promote(s.ullb);
- promote(s.ull);
- promote(s.c);
- printf("\n");
-
- promote((1 ? s.ub : 1));
- promote((1 ? s.u : 1));
- promote((1 ? s.ullb : 1));
- promote((1 ? s.ull : 1));
- promote((1 ? s.c : 1));
- printf("\n");
-
- promote(s.ub << 1);
- promote(s.u << 1);
- promote(s.ullb << 1);
- promote(s.ull << 1);
- promote(s.c << 1);
- printf("\n");
-
- promote(+s.ub);
- promote(+s.u);
- promote(+s.ullb);
- promote(+s.ull);
- promote(+s.c);
- printf("\n");
-
- promote(-s.ub);
- promote(-s.u);
- promote(-s.ullb);
- promote(-s.ull);
- promote(-s.c);
- printf("\n");
-
- promote(~s.ub);
- promote(~s.u);
- promote(~s.ullb);
- promote(~s.ull);
- promote(~s.c);
- printf("\n");
-
- promote(!s.ub);
- promote(!s.u);
- promote(!s.ullb);
- promote(!s.ull);
- promote(!s.c);
- printf("\n");
-
- promote(+(unsigned)s.ub);
- promote(-(unsigned)s.ub);
- promote(~(unsigned)s.ub);
- promote(!(unsigned)s.ub);
-
- return 0;
-}
+++ /dev/null
- signed : s.ub
- unsigned : s.u
- signed : s.ullb
- unsigned : s.ull
- signed : s.c
-
- signed : (1 ? s.ub : 1)
- unsigned : (1 ? s.u : 1)
- signed : (1 ? s.ullb : 1)
- unsigned : (1 ? s.ull : 1)
- signed : (1 ? s.c : 1)
-
- signed : s.ub << 1
- unsigned : s.u << 1
- signed : s.ullb << 1
- unsigned : s.ull << 1
- signed : s.c << 1
-
- signed : +s.ub
- unsigned : +s.u
- signed : +s.ullb
- unsigned : +s.ull
- signed : +s.c
-
- signed : -s.ub
- unsigned : -s.u
- signed : -s.ullb
- unsigned : -s.ull
- signed : -s.c
-
- signed : ~s.ub
- unsigned : ~s.u
- signed : ~s.ullb
- unsigned : ~s.ull
- signed : ~s.c
-
- signed : !s.ub
- signed : !s.u
- signed : !s.ullb
- signed : !s.ull
- signed : !s.c
-
- unsigned : +(unsigned)s.ub
- unsigned : -(unsigned)s.ub
- unsigned : ~(unsigned)s.ub
- signed : !(unsigned)s.ub
+++ /dev/null
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-\f
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-\f
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-\f
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-\f
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-\f
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-\f
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-\f
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-\f
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-\f
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
-
+++ /dev/null
-The tests in this directory are either directly copied from the picoc project or
-are subsequently modified and added to for the purpose of TinyCC project. All
-these modifications are licensed under the same terms as TinyCC as specified in
-the file COPYING.
-
-=== picoc license ===
-
-Copyright (c) 2009-2011, Zik Saleeba
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- * Neither the name of the Zik Saleeba nor the names of its
- contributors may be used to endorse or promote products derived
- from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.