Skip to content
This repository
Browse code

made the signed integer mathematical operations wrap to fix #1281

Note: This requires a full recompilation
  • Loading branch information...
commit cbb095131a78885126ec230150b2676a00136a97 1 parent f9f0b29
Vincent Isambart authored May 19, 2011
2  rakelib/builder.rake
@@ -47,7 +47,7 @@ def build_objects
47 47
     $builder.archs.each do |x| 
48 48
       output = File.join($builder.objsdir, "kernel-#{x}.bc")
49 49
       # Compile the IR for the kernel.c source file & optimize it.
50  
-      sh "#{llvm_gcc} -arch #{x} -fexceptions -fno-stack-protector #{cflags} --emit-llvm -c kernel.c -o #{output}"
  50
+      sh "#{llvm_gcc} -arch #{x} -fexceptions -fno-stack-protector -fwrapv #{cflags} --emit-llvm -c kernel.c -o #{output}"
51 51
       sh "#{opt} -O3 #{output} -o=#{output}"
52 52
       # Convert the bitcode into a C static array. We append a null byte to the
53 53
       # bitcode file because xxd doesn't, and it's needed by the bitcode
2  rakelib/builder/options.rb
@@ -154,7 +154,7 @@ def initialize(opt)
154 154
     sdk = opt.delete(:sdk)
155 155
     has_libauto = sdk ? File.exist?("#{sdk}/usr/lib/libauto.dylib") : true
156 156
     archflags = archs.map { |x| "-arch #{x}" }.join(' ')
157  
-    @cflags = "-std=c99 -I. -I./include -pipe -fno-common -fexceptions -fblocks -g -O#{OPTZ_LEVEL} -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
  157
+    @cflags = "-std=c99 -I. -I./include -pipe -fno-common -fexceptions -fblocks -fwrapv -g -O#{OPTZ_LEVEL} -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
158 158
     @cxxflags = "-I. -I./include -fblocks -g -Wall -Wno-deprecated-declarations -Werror #{archflags} #{EXTRA_CFLAGS}"
159 159
     @ldflags = '-lpthread -ldl -lxml2 -lobjc -licucore -framework Foundation'
160 160
     @ldflags << " -lauto" if has_libauto
2  test_vm/fixnum.rb
@@ -98,3 +98,5 @@ def fact(n)
98 98
   end
99 99
   p fact(8), fact(9), fact(10)
100 100
 }
  101
+
  102
+assert "18446744073709551616", "p ((2**32)*(2**32))"

0 notes on commit cbb0951

Please sign in to comment.
Something went wrong with that request. Please try again.