/usr/lib/mlton/sml/ckit-lib/HISTORY is in mlton-basis 20130715-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 | ckit history
============
Release Changes
===============
Version 0.x, 14/Sept/99 (nch)
-----------------------------
1. BuildAst flags combined into compiler-mode and source-to-source-mode
(control of scaling, insertion of explicit coersions, reduction of assign ops
reduction of sizeof).
BuildAst now contains the following flags and major modes (collections of
flags settings).
(* control of buildAst modes *)
val insert_explicit_coersions : bool ref
(* Insert explicit casts at points where there are implicit type conversions.
If true, then reduce_assign_ops should also be set. *)
val insert_scaling : bool ref
(* Insert scaling computations at pointer arithmetic. *)
val reduce_sizeof : bool ref
(* Replace sizeof expressions by integer constants. *)
val reduce_assign_ops : bool ref
(* Replace assignops by simple ops and assignments. *)
val multi_file_mode : bool ref
(* Analysis mode -- allow repeated definitions. *)
val multiFileMode: unit -> unit (* was called analysis mode *)
val compilerMode: unit -> unit
val sourceToSourceMode: unit -> unit
2. Warning for zero size arrays added.
3. Error messages are now bounded.
Error now contains Error.errorsLimit and Error.warningsLimit
which can be used to limit the printing of errors and warnings.
4. Array sizes and sizeof.
BuildAst now maintains the expressions used to define array sizes.
When printed out, these expressions are now printed.
This allows sizeof calculations to be maintained.
Note: In principle we should do the same thing for expressions in enums
and in bitfields. However sizeof is fairly unlikely to be used in these
situations. If reduce_sizeof is false and a sizeof is encountered in these
situations, a warning message will be printed.
5. Fixed build-ast so that if we get parse errors, we don't print type-checking
errors. The philosophy here is: first get file to parse, and only then worry
about semantic errors.
6. Better error messages: We had mentioned capturing error messages in a
data-structure so that a filter could be installed to print out more meaningful
error messages (e.g. instead of "ENUM inserted"). This turns out to be a rather
complex exercise. The problematic error messages involving ENUM are generated
deep within ml-yacc, and dealing with these would require non-trivial rewriting
of ml-yacc (in fact I suspect that the only way to do this would be to have our
own version of ml-yacc).
So, instead I hacked the ml-yacc specification to do slightly better error
recovery -- we now substiture "TYPE_NAME" for "ID" if there is an error
involving "ID" tokens.
To see how this might help, recall that the problematic case is when you miss a
typedef (or the related hancock-thingy). For example, with a missing
definition of mytype, the declaration:
mytype x;
is tokenized as:
ID ID;
Now, what used to happen is that the parser would try to insert an ENUM token
(a random bad choice). Instead, the parser now tries to interpret the ID as a
TYPE_NAME, and so in effect we get:
TYPE ID;
and an error message:
"foo.c": error: syntax error: replacing ID with TYPE_NAME
I've experimented with some support for inserting heuristic help messages (an
extension to the Error struct). I think it is rather ad hoc, but let me know
how useful it is. The actual message that is printed now for the above scenario
is
"file.c": error: syntax error: replacing ID with TYPE_NAME
Likely cause: missing typedef declaration.
This message can be customized (it appears as a function call in the grammar
file), and others could be added.
I've also configured build-ast so that when there are parser errors, error
reporting during type checking is switched off, since such type checking errors
tend to be quite confusing.
----------------------------------------------------------------------
Version 1.0b1, 7/Dec/1999
-------------
Error interface changed.
Top level interfaces for build-ast changed.
----------------------------------------------------------------------
Version 1.0b2, 13/Jan/2000
--------------
Bug fixes.
Revise regression test suite.
Version 1.0b3, 15/Mar/2000
-------------
Bug fixes: Bugs 1,3,5,6,7,9,10
Made sizes (Sizes.sizes) a record and parameterized makeAst on sizes.
Added various regression tests for bugs.
Version 1.0, 15/Mar/2000
-------------
* Bug fixes: Bugs 2, 4, 8, 12, 13
* Reworked size and alignment mechanism to support parameterization
(see src/ast/sizes[-sig].sml). A utility program (src/c-util/sizes.c)
can be used to generate sizes info for a given compiler/platform
combination.
Version 1.x (x > 0), Halloween 2001 (boo! :-), M.Blume
-----------
* Changed the "Function" constructor of type Ast.ctype to carry optional
argument identifiers.
* Changed the return type of TypeUtil.getFunction accordingly.
* Type equality ignores the argument names.
* TypeUtil.composite tries to preserve argument names but gives up
if there is a mismatch.
======================================================================
Bug fix history
======================================================================
Test: valid-programs/a40.c
Status: fixed 15/june/99
Fix: Changed (ty, ty, signedNum CT.INT, expop)
to (ty, ty, ty, expop)
in mulDivOp (build-ast.sml)
Also change similar code in integralOp.
Email:
From: chandra@research.bell-labs.com (Satish Chandra)
Date: Fri, 21 May 1999 14:00:28 -0500
Nevin:
Have you already caught this one?
File build-ast-fn.sml:
Function mulDivOp in case PT.Binop, about line 1216 in my version:
then (case usualBinaryCnv env (ty1, ty2) of
SOME ty => (ty, ty, signedNum CT.INT, expop)
^^^^^^
If we were type checking a float multiplied by a float, we would
lose, right?
The Wisconsin folks came up with this example, which does not
produce the correct adornments.
float f = 5.6, f1;
int main() {
f1 = f * f;
return 0;
}
-satish
---------------------------------------------------------------------------
Test: valid-programs/a37.c
Status: fixed 15/june/99
Fix: added case "| ([CT.Void], nil) => (nil, nil)" to isAssignableL (type-util.sml)
Email:
From: chandra@research.bell-labs.com (Satish Chandra)
Date: Tue, 25 May 1999 15:00:52 -0500
A function with a 'void' argument as its only argument is basically
a function with no arguments. E.g.:
void f(void);
main()
{
f();
}
We issue a Type Warning: function call has too few args
I can go fix these things myself, but it will make it harder to
synchronize our changes. Please give me a call so we can make a plan
on how to go about it.
-satish
------------------------------------------------------------------------------
Test: valid-programs/a38.c
Status: fixed sometime in early june/99
Fix: fixed during major overhaul of frontend
From: chandra@research.bell-labs.com (Satish Chandra)
Date: Thu, 03 Jun 1999 20:17:56 -0500
When perform_type_checking is on, it complains about
for(;;)
as "condition of for statement is not scalar".
The problem stems from the use of isScalar, without checking for EmptyExp
first.
-satish
-------------------------------------------------------------------------------
Test: valid-programs/a39.c
Status: fixed sometime before 15/june/99 (probably before major frontend overhaul?)
Fix: seems to have been fixed as side-effect of some other bug-fix or code change.
Email:
Date: Thu, 20 May 1999 09:16:37 -0400 (EDT)
From: Kathleen Fisher <kfisher@research.att.com>
There seems to be a bug involving the ++ operator.
The following does not work:
p->count[i]++ /* generates an error. */
p->count[i] = p->count[i]+1; /* OK */
Kathleen
--------------------------- Sat Jul 31 18:36:00 1999 --------------------------
Test: valid-programs/a60.c
Status: fixed 31/july/99
Fix: add case for TCInitializer so that if type is not core, then apply getCoreType
(Alternatively, we could impose the invarient that TCInitializer must be
applied only to core types, but this would be a pain becuase TCInitializer
has a number of recursive calls.)
Email:
build-ast.sml (TCInitializer) does not appear to look into typedefs.
Therefore,
typedef struct {int x,y; } point;
point x = {2,3};
fails to typecheck although gcc accepts it.
--------------------------- Sat Jul 31 19:12:59 1999 --------------------------
Test: valid-programs/a61.c
Status: fixed 31/july/99
Fix: Shadow struct definitions were simply ignored. They generated nothing in
Ast, and in fact there was no way to represent these definitions.
The fix was to change the TypeDecal contructor from:
TypeDecl of tid
to
TypeDecl of {shadow: {strct:bool} option, tid:tid}
and then use TypeDecl{SOME{strct=true}, tid=....} to represent "struct x;"
TypeDecl{SOME{strct=false}, tid=....} to represent "union x;"
Email:
Date: Thu, 29 Jul 1999 14:15:12 -0400
From: Fred Smith <fsmith@research.att.com
I couldn't figure out exactly why but the compiler does not seem to emit
anything for empty structure declarations such as
struct t;
although the code looks like it should. Instead it just omits them. In
one of the libraries we are using, a declaration like this is used to
hide implementation details. When omitted we get a lot of spurious
warnings from the C compiler.
--------------------------- Sat Jul 31 20:14:32 1999 --------------------------
Test: valid-programs/a62.c
Status: fixed 31/july/99
Fix: Spurious casts were inserted in some cases because the eq test that was used by cast
did not deref typedefs (amongst other things).
The simple fix is to replace:
if lookAid aid' = ty then expr (* DBM: gen. equality on types *)
by
if getCoreType(lookAid aid') = getCoreType ty then expr (* DBM: gen. equality on types *)
in the code for wrapCast.
Email:
Date: Thu, 29 Jul 1999 17:00:54 -0400
From: Fred Smith <fsmith@research.att.com>
I ran some tests and a cast is being inserted whenever
a typedef occurs. In fact the following code:
typedef struct { int x,y,z; } w;
void main() {
w foo;
foo = foo;
}
is compiled to
struct t12 { int x,y,z; };
typedef struct t12 w_t13;
void main ()
{
w_t13 foo_p17;
foo_p17 = ((struct t12) foo_p17);
}
modulo formatting.
--------------------------- Sat Jul 31 20:24:30 1999 --------------------------
Test: invalid-programs/r60.c
Status: fixed 31/july/99
Fix: Get rid of extra loc args in definitions of checkAssignableTys and checkAssign.
Date: Fri, 30 Jul 1999 10:15:36 -0400
From: Fred Smith <fsmith@research.att.com>
The following C program compiles and type-checks under Ckit but
obviously should not.
struct w { int x,y,z; };
void main() {
struct w foo;
float x;
x = foo;
}
It took me a long time to track this one down since the code looks
absolutely correct. The problem was that all calls to checkAssign in
build-ast.sml failed to pass in a location. Since checkAssign was being
used solely for its side-effect, both occurences were in contexts like
(one case preceded a ; )
val _ = checkAssign ....
--------------------------- Wed Sep 22 17:20:03 1999 --------------------------
Test: valid-programs/a63.c
Status: fixed 22/Sept/99
Fix: apply preArgConv to parameter types before adding them to local symbol table
The following C program does not type check under ckit and it should:
void f();
main () {
int y[4];
f(y);
}
void f(int x[4]) {
int *y;
x = y;
x[3] = 1;
}
C is a horrible language -- if you declare an array as an arg to a function,
then "array of type" is adjusted to "pointer to type".
--------------------------- Wed Sep 22 17:34:55 1999 --------------------------
Test: invalid-programs/r62.c
Status: fixed 22/Sept/99
Fix: use lookLocalScope to check if parameter is locally defined before adding it.
The following C program type checks under ckit and it should not:
main () {
return(0);
}
f(int x, int x) {
x = x;
}
--------------------------- Mon Sep 27 19:17:33 1999 --------------------------
Test: not available
Status: fixed 27/Sept/99
Problem: Redeclarations did not inherit the pid of the previous declaration.
e.g.
extern int i;
extern int i;
would be allocated different pid's.
Bug was introduced during build-ast overhaul.
Fix: checkIdRebinding now returns an extra parameter (a uid option).
--------------------------- Mon Sep 27 19:20:48 1999 --------------------------
Test: not available
Status: fixed (see a64.c, a65.c below)
Problem: We don't check for non-constant expressions in non-simple initializers.
int f(int j) {
int x[4] = {0,1,2,3}; /* this is ok */
int x[4] = {0,j,2*j,3*j}; /* this isn't */
}
but our frontend currently gives an unhesitant thumbs up for this code.
--------------------------- Fri Oct 15 14:24:36 1999 --------------------------
Test: not available
Status: fixed 15/Oct/99
Fix: in sizeof.sml, function computeFieldListStruct,
change foldr to foldl and reverse final list.
Problem:
> From: chandra@research.bell-labs.com (Satish Chandra)
> Date: Thu, 14 Oct 1999 22:30:05 -0500
>
> This has been quite a while, and the code might have changed much, but ...
>
> In function computeFieldListStruct, foldr computes offsets the wrong way.
> I think we need foldl, and later on reverse the accumulated list called
> "tab".
--------------------------- Tue Sep 14 11:30:44 1999 --------------------------
TEST: a64.c, a65.c
STATUS: fixed 12/jan/99
FIX: propagated isZeroExpr info for function args to checkFn (in type-utils),
so that zero test can be included when checking assignment of zero to
arg of pointer type.
EMAIL:
From: Kathleen Fisher <kfisher@research.att.com>
Date: Mon, 10 Jan 2000 15:28:02 -0500 (EST)
The ckit compiler doesn't treat 0 as a legal function pointer. The
program:
***************************************************
void f(int(* goo)(int)){}
void main(){
f(0);
}
***************************************************
gives the error message:
"/fs/smaug/home4/kfisher/hancock/tests/suite/test.hc":4.2-6: error: Bad
function call: arg 1 has type int but fn parameter has type int (*) (int)
Kathleen
--------------------------- Tue Jan 11 23:12:50 2000 --------------------------
TEST: a66.c
STATUS: fixed 12/jan/99
FIX: Pretty-printer bug.
pp-ast-fn.sml:
changed the code for the e0 case of QuestionColon to
; ppExpr {nested=true} aidinfo tidtab pps e0
EMAIL:
From: Alexey Loginov <alexey@cs.wisc.edu>
Date: Sun, 28 Nov 1999 12:43:16 -0600 (CST)
Hi Nevin and Dave,
We found another bug that isn't fixed in the version of ckit you sent
us. I also didn't see it in the bug list. Expressions containing the
"?:" operator are not parenthesized correctly to account for its
right-associativity. (In the following program, lines 5 and 7 mean
the same thing but line 6 is different.)
void main() {
char a, b, c, d, e;
a?b:c?d:e; /* Line 5. */
(a?b:c)?d:e; /* Line 6. */
a?b:(c?d:e); /* Line 7. */
}
Output C code:
- ParseToAst.fileToC "/u/a/l/alexey/types/test/quest_col.c";
void main ()
{
char a;
char b;
char c;
char d;
char e;
a ? b : c ? d : e;
a ? b : c ? d : e;
a ? b : c ? d : e;
}
Thanks,
-Alexey
--------------------------- Tue Jan 11 23:12:52 2000 --------------------------
TEST: r64.c
STATUS: fixed 12/jan/00
FIX: Add check of initializers to see if const (only non-const
case is an object of dynamic storage duration (i.e. non-global, non-static).
Notion of const is complex -- need to recurse through arithmetic, ?-: etc.
(Long term issue: constant expressions should really be reduced to constants.)
EMAIL:
Date: Tue, 7 Dec 1999 17:22:48 -0500 (EST)
From: Kathleen Fisher <kfisher@research.att.com>
The following code:
struct foo_t{
int x;
int y;
};
void f(int x0, int y0){
struct foo_t myfoo = {x0,y0};
}
void main(){
f(0,0);
}
passes through the ckit compiler without complaint, but cc reports the
following error:
"bug.c", line 8: error(1028): expression must have a constant value
struct foo_t myfoo = {x0,y0};
^
"bug.c", line 8: error(1028): expression must have a constant value
struct foo_t myfoo = {x0,y0};
======================================================================
Numbered Bugs
======================================================================
NUMBER: 1
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/10/00
TEST: regression/valid-programs/a211.c,a212.c,a213.c,a214.c,a215.c
STATUS: fixed 3/10/00 (nch)
DESCRIPTION:
Enum constants which were not assigned values in original source
are assigned 0 in output.
- enum { e1,e2,e3 } e;
--> enum t1 { e1=0, e2=0, e3=0 };
enum t1 e;
----------------------------------------------------------------------
NUMBER: 2
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/10/00
TEST:
STATUS: fixed 3/31/00
DESCRIPTION:
functions returning function pointers. Function signal is a good
real-life example. It's mentioned in Harbison and Steele p. 270
or so (sorry I don't have the book with me).
int (*fp(double))(float);
--> int (*) (float) fp (double);
which does not compile.
----------------------------------------------------------------------
NUMBER: 3
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/10/00
TEST: regression/valid-programs/a216.c
STATUS: fixed 3/10/00
FIX: The problem was that the type for the second variable was array(const char),
and the code did not strip off the const inside the array constructor.
The fix was to add an extra case to look for qualifiers inside arrays in initializer-normalizer.
DESCRIPTION:
inconsistent interpretation of initialization of constant
character arrays:
char c[] = "abcdefg";
const char cc[] = "abcdefg";
--> char c[8]={97,98,99,100,101,102,103,0};
char const cc[1]={"abcdefg"};
----------------------------------------------------------------------
NUMBER: 4
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/10/00
TEST: a232.c
STATUS: fixed 24/Mar/00
FIX:
The pretty-printer in fact has enough information to know
whether the original definition of a function was k&r or not:
just look at the function params and at the function type.
If the function type has no args, but the function has
params, then we have k&r style.
The case of FunctionDef in ppCoreExternalDecl now
has code to recognize this case and print out K&R defns.
DESCRIPTION:
old style C function parameter declarations have different
semantics from new style (with respec to promotions) and
should be preserved.
void foo(int);
void foo(c)
char c; { }
--> compiles, but
void foo(int);
void foo(char c) { }
--> which is output by ckit, does not
----------------------------------------------------------------------
NUMBER: 5
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/10/00
TEST: regression/valid-programs/a222.c (for both problems)
STATUS: fixed 3/10/00
FIX for 1: change default value of flag local_externs_ok to true
FIX for 2: changed checking code for initializations (build-ast.sml and initializer-normalizer.sml)
DESCRIPTION:
Inconvinient Warnings:
- int foo() { extern int bar; }
--> error: `extern' not allowed in local declarations
- struct S s = t; (in general, struct S = <exp> where <exp> is
not of the form {...})
--> error: badly formed union/struct initializer: expecting {
COMMENT:
These last two errors don't seem to affect the output, so we just
ignore them. The others are causing problems on various utilities of
the GNU website. (We're ignoring the issues with the use of GNU C.)
Local extern warning was fixed by making local_externs_ok contain true
in build-ast.sml. There remains a question about whether the semantics
is correct in all cases. (see regression/invalid-programs/r65.c, which
appears to be handled properly -- produces an error message.) [dbm, 3/10/00]
----------------------------------------------------------------------
NUMBER: 6
SUBMITTER: John Reppy <jhr@research.bell-labs.com>
DATE: 2/10/00
TEST: none
STATUS: fixed
FIX: introduced a sizes record type in sizes-sig.sml, and parameterized
makeAst, SizeOf fns, and ParseToAst.fileAst' with respect to sizes.
The Sizes structure provides a default value Sizes.defaultSizes.
sizes-sig.sml and sizes.sml moved from variants(/ansic) to ast.
[Plan is to provide a structure containing a set of sizes values for
various platform/compiler combinations.]
Removed bogus stale sizes-sig.sml file (the real signature contains longlong and longdouble).
Fixed sizeof so that it now:
a) provides the standard functionality for bitfields of char and short;
b) has flags to modify the standard behaviour
We can now simulate the behaviour of cc, lcc and gcc (wrt e.g. alignment
issues for unnamed bitfields).
DESCRIPTION:
The type metrics in the CKit are broken in several ways. First, it seems
that the SIZES signature does not include longlong or longdouble. Second,
the sizes are hard-coded in, instead of being ABI dependent. I'd recommend
replacing the Sizes structure with a record type:
type metrics = {bits : int, align : int}
type interface = {
charMetric : metrics,
shortMetric : metrics,
intMetric : metrics,
longMetric : metrics,
longlongMetric : metrics,
floatMetric : metrics,
doubleMetric : metrics,
longdoubleMetric : metrics,
pointerMetric : metrics,
structAlign : int,
bitFieldAlignment : int option
}
For the IA32/SVID, the values should be
char 8 8
short 16 16
int 32 32
long 32 32
long long 64 32
float 32 32
double 64 32
long double 96 32
pointer 32 32
struct align - 8
One can probably write a small C program that generates this information.
[jhr has given one to nch -dbm]
[dbm, 3/8/00] The ast/sizes-sig.sml version of SIZES doesn't include
longlong or longdouble, but the variants/sizes-sig.sml version does.
That seems to be the version used in (e.g.) variants/*/config.sml.
The variants/sizes-sig.sml also defines a "layout" type corresponding
to John's "metrics". The ast version of SIZES does not seem to be
mentioned anywhere except in ast/sizes-sig.sml, where it is defined,
so it looks like this is an old, vestigial version that has been superceded
by the variants version.
[dbm, 3/14/00] John still advocates using a record. He anticipates wanting
to switch target architectures dynamically (either by passing the record
as a value, or by setting a global value) in the midst of processing.
----------------------------------------------------------------------
NUMBER: 7
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/18/00
TEST: regression/valid-programs/a224.c
STATUS: fixed 3/10/00 (see bug 9)
DESCRIPTION:
'\0' is treated as '0' and not as a null character. We didn't check
for any other special characters.
INPUT:
char c_null = '\0';
char c_zero = '0';
int main () { return 0; }
OUTPUT:
char c_null=48;
char c_zero=48;
int main ()
{
return 0;
}
COMMENT:
This is a special case of bug 9.
----------------------------------------------------------------------
NUMBER: 8
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/18/00
TEST: a227.c
STATUS: fixed 24/Mar/00
FIX:
The problem was in type-util.sml,
where the function conditionalExp is used to type check conditional expressions.
The relevant case statement in the body of the function is
where both arguments (after usualUnaryCnv) have Pointer type.
In this case, composite is called -- the problem is that the
call to composite reverts to the original arguments ty1 and ty2 of the call
to conditionalExp, rather than the results of applying usualUnaryCnv.
(Note that the function composite can not and should not
apply usualUnaryCnv to its arguments.)
It turns out that this same error appears in three other places in the code
(in isEquable, isSubtractable and isComparable).
With insert_explicit_coersions set to true, you now obtain:
original program (a227.c):
int main() {
int *ip;
int *jp;
int ia[3];
jp = (1 ? ia : ip);
}
fileToC output:
int main ()
{
int *ip;
int *jp;
int ia[3];
jp = (1 ? (int *) ia : ip);
}
DESCRIPTION:
"?:" operator typing.
int *ip;
int *jp;
int ia[3];
jp = (1 ? ia : ip);
--> error: Type Error: Unacceptable operands of question-colon.
C semantics (we think):
--> jp = (1 ? (int *) ia : ip);
^^^^^^^
(implicit cast of ia to pointer)
Current implementation:
--> jp = (1 ? ia : (int[3]) ip);
^^^^^^^^
(implicit cast of ip to array)
COMMENT:
Of course, code is still output correctly (without the implicit cast)
but since we actually use the implicit casts to materialize some
casts, we rely on their correctness.
----------------------------------------------------------------------
NUMBER: 9
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/22/00
TEST: regression/valid-programs/a223.c
STATUS: fixed 3/10/00
DESCRIPTION:
To follow up on this [bug 8] I wanted to mention that it looks like ckit
handles '\ooo' in three different ways depending on the number of
octal digits. In C the number of digits can be 1-3 but ckit only
handles 3 digit numbers correctly. Two digit numbers are processed as
decimal numbers. Single digit numbers are processed as if '\' weren't
there (i.e. taken as ascii values).
INPUT:
char c_octal_0 = '\0';
char c_octal_51 = '\051';
char c_octal_60 = '\60';
char c_octal_7 = '\7';
int main () { return 0; }
OUTPUT:
char c_octal_0=48; /* Should be 0 */
char c_octal_51=41; /* Correct */
char c_octal_60=60; /* Should be 48 */
char c_octal_7=55; /* Should be 7 */
int main ()
{
return 0;
}
Of course, '\0' is the most common of these. Do you have a time frame
for when you think the problems I mentioned before might be fixed?
COMMENT:
[dbm] fixed by changing the rule in parser/grammar/c.lex to take 1 to 3
octal digits instead of exactly 3 ({1,3} replaced {3} as the modifier).
----------------------------------------------------------------------
NUMBER: 10
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 2/23/00
TEST: regression/valid-programs/a226.c
STATUS: fixed 3/10/00
FIX: Stupid cut-and-paste problem: preincrements/predecrements were getting
transformed into postincrements/postdecrements in build-ast.sml.
DESCRIPTION:
preincrement and predecrement behavior
INPUT:
int main () {
int i = 10;
int i1 = ++i;
int i2 = --i;
return 0; }
OUTPUT:
int main ()
{
int i=10;
int i1=i++;
int i2=i--;
return 0;
}
COMMENT:
----------------------------------------------------------------------
NUMBER: 12
SUBMITTER: Kathleen Fisher <kfisher@research.att.com>
DATE: 3/15/00
TEST: a230.c
STATUS: fixed 24/Mar/00
FIX:
The bug was because the implementation of the non-default
behaviour of convert_function_args_to_pointers was not complete (there was
a missing case in isAssignable in type-utils.sml). To put it another way,
too much of the code was assuming that convert_function_args_to_pointers
was set to the standard value, and in particular, that certain coersions had
been performed *before* isAssignable was called. These coersions are not
performed when convert_function_args_to_pointers is false.
DESCRIPTION:
We've run into a problem with ckit when we turn the flag
convert_function_args_to_pointers to false in the config.sml file.
The following program:
********************************************************
typedef int *windowTy[1];
int f (windowTy w)
{
return 1;
}
void main(){
windowTy w;
f (w);
}
********************************************************
compiles just fine using cc, but it generates the following
error if we compile it with ckit:
"array-param.hc":11.3-8: error: Bad function call: arg 1 has type windowTy
but fn parameter has type windowTy
----------------------------------------------------------------------
NUMBER: 13
SUBMITTER: Olivier Tardieu
DATE: 24/Mar/00
TEST: a301.c
STATUS: fixed 24/Mar/00
FIX:
! should be type checked like || and && instead of like a simple
unary operator. Extra code (a function logicalOp1) has
been added to do this.
DESCRIPTION:
main() {
void* p;
!p;
}
gives type error
error: Type Error: operand of unary op ! must be a number.
----------------------------------------------------------------------
NUMBER: 14
SUBMITTER: Alexey Loginov <alexey@cs.wisc.edu>
DATE: 4/17/00
TEST: a240.c
STATUS: fixed 16/June/00
FIX:
There is a flag to control this behaviour in config.sml:
Config.TypeCheckControl.convert_function_args_to_pointers
It should be set to true for standard behaviour (but was set to false
for some reason -- maybe temporarily for debugging something else, and then
not reverted back to true??).
This is actually an ambiguous case: a strict reading of the standard would
suggest that this should be flagged as a type error, but most
compilers allow it, so it is "standard".
DESCRIPTION: array formals
This one is similar to the ?: bug we reported earlier (Bug number 8).
void foo(int a[]);
int main() {
int * ip;
foo(ip);
}
Output:
"tt.c":5.3-10: error: Bad function call:
arg 1 has type int * but fn parameter has type int []
Correct C output is still produced but the implicit type of ip inside
the call to foo has int array type. This is a problem for our
instrumentation.
|