This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Why doesn't it work? Can it be made to work relatively easily? Do we need functionality like this for Ada or Java?
Ada currently has to do this itself, precisely because -ftrapv doesn't work, so it's not the case that Ada "needs" it.
procedure k (x : out integer; y,z : integer) is begin x := y + z; end;
procedure k (x : out integer; y : integer; z : integer) is begin [constraint_error when not (long_long_integer?(y) + long_long_integer?(z) in -16#8000_0000# .. 16#7FFF_FFFF#) "overflow check failed"] x := integer?(long_long_integer?(y) + long_long_integer?(z)); return; end k;
__ada_k: LFB3: pushl %ebp LCFI0: movl %esp, %ebp LCFI1: pushl %ebx LCFI2: subl $4, %esp LCFI3: movl 8(%ebp), %eax movl 12(%ebp), %ecx movl %eax, %edx movl %ecx, %ebx sarl $31, %edx sarl $31, %ebx addl %eax, %ecx adcl %edx, %ebx movl %ecx, %eax addl $-2147483648, %eax movl %ebx, %edx adcl $0, %edx cmpl $0, %edx jbe L6 pushl %eax pushl %eax pushl $3 pushl $LC0 LCFI4: call ___gnat_rcheck_10 .p2align 4,,7 L6: movl %ecx, %eax movl -4(%ebp), %ebx leave ret
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |