summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/gcc/enquire.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-03-08 18:31:45 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-03-08 18:31:45 +0000
commit5af0055602c4db78f82eccafe751ca54f499fdf1 (patch)
treeead0655d4b5ec422a5903a6bba4b1168cd5963e7 /gnu/usr.bin/gcc/enquire.c
parent6e60ece9f7cb1dc3cf104ee80f2b47c728eed447 (diff)
update to gcc 2.8.1
Diffstat (limited to 'gnu/usr.bin/gcc/enquire.c')
-rw-r--r--gnu/usr.bin/gcc/enquire.c49
1 files changed, 35 insertions, 14 deletions
diff --git a/gnu/usr.bin/gcc/enquire.c b/gnu/usr.bin/gcc/enquire.c
index 178d029d192..b46c7d33066 100644
--- a/gnu/usr.bin/gcc/enquire.c
+++ b/gnu/usr.bin/gcc/enquire.c
@@ -1408,21 +1408,42 @@ int cprop() {
c=0; char_max=0;
c++;
- if (setjmp(lab)==0) { /* Yields char_max */
- while (c>char_max) {
- char_max=c;
- c++;
- }
+ if (bits_per_byte <= 16) {
+ if (setjmp(lab)==0) { /* Yields char_max */
+ while (c>char_max) {
+ char_max=c;
+ c++;
+ }
+ } else {
+ Vprintf("%sCharacter overflow generates a trap!%s\n",
+ co, oc);
+ }
+ c=0; char_min=0;
+ c--;
+ if (setjmp(lab)==0) { /* Yields char_min */
+ while (c<char_min) {
+ char_min=c;
+ c--;
+ }
+ }
} else {
- Vprintf("%sCharacter overflow generates a trap!%s\n", co, oc);
- }
- c=0; char_min=0;
- c--;
- if (setjmp(lab)==0) { /* Yields char_min */
- while (c<char_min) {
- char_min=c;
- c--;
- }
+ /* An exhaustive search here is impracticable ;-) */
+ c = (1 << (bits_per_byte - 1)) - 1;
+ char_max = c;
+ c++;
+ if (c > char_max)
+ char_max = ~0;
+ c = 0;
+ char_min = 0;
+ c--;
+ if (c < char_min) {
+ c = (1 << (bits_per_byte - 1)) - 1;
+ c = -c;
+ char_min = c;
+ c--;
+ if (c < char_min)
+ char_min = c;
+ }
}
if (c_signed && char_min == 0) {
Vprintf("%sBEWARE! Chars are pseudo-unsigned:%s\n", co, oc);