The LLVM compiler is the next-generation compiler introduced in Xcode 3.2 for Snow Leopard based on the open source LLVM.org project.

Posts under LLVM tag

53 Posts
Sort by:
Post not yet marked as solved
3 Replies
2.5k Views
Dear Apple,Is there a clang diagnostic ignore for the warning "Cannot find protocol definition for <...>"?While I cannot make the definition available in the header, every file importing this header will also import the definition. In which case, the code will run correctly (right?)
Posted
by
Post not yet marked as solved
1 Replies
698 Views
I have a framework with both Swift and Objective-C code. For some reason, the compiler decided that it was necessary to import the framework's umbrella header in its generated Swift.h file. This is causing duplicate definition errors and preventing me from compiling.Example:Framework called "MyFramework"Swift code generates "MyFramework-Swift.h"Contents of MyFramework-Swift.h includes this line:#import <MyFramework/MyFramework.h>This causes the errors and prevents me from building. Changing random lines of Swift code seems to make it NOT put this line in the Swift.h file, but this is not a working solution for me as I need the line of Swift code in question. It was not causing this error before.Any hints on how to prevent the compiler from putting its own umbrella header into the generated Swift.h file?
Posted
by
Post not yet marked as solved
2 Replies
4k Views
We currently have a legacy Objective-C framework that we'd like to introduce some Swift components into. However, I can't figure out how to access the Private- and Project-scoped Objective-C files from our Swift files.We already use an umbrella header and a modulemap file to declare the public headers that should be included in the library's module, and we want to keep these as the only publicly exposed files. However, our new Swift files (within the same framework) need to also access private headers that we don't want to expose.I've already tried defining a private modulemap file that lists the private headers I want to use, and then specified it with the MODULEMAP_PRIVATE_FILE build setting, but I dont think this does what we want. It appears to introduce a new MyLibrary.Private module which is publicly visible to external targets (such as the unit test target) but is still not available to the Swift files within the framework.Any suggestions of how this can be accomplished, or experience doing this in other projects would be greatly appreicated.Thanks!
Posted
by
Post not yet marked as solved
9 Replies
25k Views
Hello,Just upgraded XCode to version 10. I tried to compile my project which use both Objective-C and C++ files.One of the cpp files includes a header file (.h) which has the following line:#include <new>Compiler gives this error: 'new' file not foundWhy is that? I didn't have this problem with XCode 9.Thanks,Kal
Posted
by
Post not yet marked as solved
2 Replies
1.5k Views
Hi there, We are currently facing a problem around compilation and `swiftc` command.When building, xcode gives the list of files to compile to swiftc in absolute path :CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler (in target: Module) cd /Users/user/Documents/workspace/company/project export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name Module -Onone -whole-module-optimization -enforce-exclusivity=none -DDEBUG -Onone -sdk /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -target x86_64-apple-ios9.3-simulator -g -module-cache-path /Users/user/Documents/workspace/company/project/DerivedData/ModuleCache.noindex -Xfrontend -serialize-debugging-options -profile-coverage-mapping -profile-generate -enable-testing -index-store-path /Users/user/Documents/workspace/company/project/DerivedData/project/Index/DataStore -swift-version 4.2 -I /Users/user/Documents/workspace/company/project/DerivedData/project/Build/Products/development-iphonesimulator -F /Users/user/Documents/workspace/company/project/DerivedData/project/Build/Products/development-iphonesimulator -F /Users/user/Documents/workspace/company/project/Carthage/Build/iOS /Users/user/Documents/workspace/company/project/Module/File.swift /Users/user/Documents/workspace/company/project/Module/File2.swift /Users/user/Documents/workspace/company/project/Module/File3.swiftWe found the `working-directory` parameter to the swiftc command and wonder how to make xcode use it, in order to reduce the command line length ?We are currently reaching the mac os buffer limit for command line, that is 2Mb.
Posted
by
Post not yet marked as solved
1 Replies
733 Views
I'm studying iOS crash analysis. Now, I need to import crashlog files into LLDB. As WWDC18 Session 414 said, I now have a copy of myApp, dSYM, ***.crash. Run the following command in a folder that I created:$ lldb(lldb) command script import lldb.macosx.crashlog(lldb) crashlog /xxxx.crashHowever, the stack trace file is not available and there is only a lot of error like:error: unable to locate any executables from the crash logDid I use it wrong? What is the correct stepts?Thanks in advance. For any question please just let me know.
Posted
by
Post not yet marked as solved
3 Replies
6.9k Views
I've got a decent size project with 10 or so dependencies. I've just switched to Xcode 11 and moved all the modules I can from using Carthage to the new SPM support in Xcode.One of my dependencies is https://github.com/iwasrobbed/Down.git a common markdown parser. It includes libcmark, a C library. After cleaning my build folder, the only module map is./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemapThe first build works, but now find returns./SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap ./Build/Intermediates.noindex/Down.build/Debug/libcmark.build/libcmark.modulemapAfter making a change to the source code and recompiling, the same two modulemaps are there, but I get the error/Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/Build/Intermediates.noindex/GeneratedModuleMaps/macosx/libcmark.modulemap:1:8: error: redefinition of module 'libcmark' module libcmark { ^ /Users/mlilback/Library/Developer/Xcode/DerivedData/Rc2Client-bqmhvrpuhrtqjdfbdeqbqzhmotdc/SourcePackages/checkouts/Down/Source/cmark/include/module.modulemap:1:8: note: previously defined here module libcmark [system][extern_c] { ^This makes no sense to me. Why does it compile the first time? What can I do to avoid constantly having to clean the build folder and wait for a fresh build?
Posted
by
Post not yet marked as solved
7 Replies
836 Views
When I set the icon for a file using[[NSWorkspace sharedWorkspace] setIcon: myImage forFile: [[sheet URL] path] options: NSExcludeQuickDrawElementsIconCreationOption];2019-11-21 14:34:44.954590-0700 Appname[4856:152311] [default] Invalid image size X: 1024 Y: 1152XCode 11.2.1 correctly sets the file icon to myImage but logs the error 14 times. This didn't happen in older versions of XCode. The Developer Documentation doesn't say anything about any particular requirements for the size if the NSImage. Setting the the options to either one of the two options doesn't change the error. Is this a spurious error? Am I missing something. Should I file a bug report?
Posted
by
Post not yet marked as solved
7 Replies
6.2k Views
This topic was touched on in the notes for the WWDC 2019 session on Binary Frameworks - I even watched the whole video but it wasn't covered there.It appears I should be able to wrap a static library - one that is created by its own (complex) build scripts - and have iOS, iOS Simulator and macOS versions. Also, that the header files can be included as well.I have been unable to find any information googling around on how one might do this. I would greatly appreciate any pointers to some blog/post that covers this.Thanks!
Posted
by
Post not yet marked as solved
37 Replies
15k Views
I have a new warning per every target after upgrading to Xcode 11.4:Invalid debug info found, debug info will be strippedThis has never been the case for my code base before. Anything I can do to resolve these warning? Am I safe to release to the AppStore with these warnings? For one of the targets detailed info is:mismatched subprogram between llvm.dbg.label label and !dbg attachment call void @llvm.dbg.label(metadata !137) #2, !dbg !203 label %138 double (i8*)* @"\01__hidden#1918_" !137 = !DILabel(scope: !138, name: "zulu_time", file: !10, line: 196) !138 = distinct !DISubprogram(name: "parseTimezone", scope: !10, file: !10, line: 161, type: !139, scopeLine: 161, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !171, retainedNodes: !196) !203 = !DILocation(line: 196, column: 1, scope: !100, inlinedAt: !101) !100 = distinct !DISubprogram(name: "__hidden#1928_", scope: !10, file: !10, line: 161, type: !11, scopeLine: 161, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6) mismatched subprogram between llvm.dbg.label label and !dbg attachment call void @llvm.dbg.label(metadata !347), !dbg !371 label %55 i32 (i8*, ...)* @"\01__hidden#1920_" !347 = !DILabel(scope: !348, name: "end_getDigits", file: !10, line: 140) !348 = distinct !DISubprogram(name: "getDigits", scope: !10, file: !10, line: 109, type: !349, scopeLine: 109, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !171, retainedNodes: !351) !371 = !DILocation(line: 140, column: 1, scope: !315) !315 = distinct !DISubprogram(name: "__hidden#1922_", scope: !10, file: !10, line: 109, type: !11, scopeLine: 109, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !6) DICompileUnit not listed in llvm.dbg.cu !171 = distinct !DICompileUnit(language: DW_LANG_C99, file: !7, producer: "Apple clang version 11.0.3 (clang-1103.0.32.29)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !12, retainedTypes: !172, imports: !180, nameTableKind: None) ld: warning: Invalid debug info found, debug info will be stripped !dbg attachment points at wrong subprogram for function !126 = distinct !DISubprogram(name: "__hidden#2776_", scope: !35, file: !35, line: 259, type: !36, scopeLine: 259, s: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !11) double (%0*, i8*, %0*, i32)* @"\01__hidden#2776_" br i1 %41, label %42, label %90, !dbg !152, !llvm.loop !155 !156 = !DILocation(line: 283, column: 3, scope: !157) !157 = distinct !DISubprogram(name: "__hidden#2776_", scope: !35, file: !35, line: 259, type: !36, scopeLine: 259, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !158) !157 = distinct !DISubprogram(name: "__hidden#2776_", scope: !35, file: !35, line: 259, type: !36, scopeLine: 259, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !158) ld: warning: Invalid debug info found, debug info will be stripped mismatched subprogram between llvm.dbg.label label and !dbg attachment
Posted
by
Post not yet marked as solved
11 Replies
8.9k Views
I've got an iOS framework that I've had around for ages. It's a mixture of Objective-C and Swift. Since installing Xcode 12, I'm now getting a bunch of warnings of the type: 'Double-quoted include in framework header, expected angle-bracketed instead' If I go to the various source files and say change: #import "Place.h" to #import <VegasKit/Place.h> then I get an error saying it can't find the file. If I try this: #import <Place.h> then I get an error telling me to go back to double-quotes, i.e. undo the change. Any idea what I can do to get this all setup correctly? Thanks.
Posted
by
Post not yet marked as solved
2 Replies
1.3k Views
Hello Team, I am facing the clang error when I am trying to run the source in Xcode 12.5 BUT it is working fine in 11.4 In file included from :1: PrefixHeader.pch:15:2: fatal error: malformed or corrupted AST file: 'mismatched umbrella headers in submodule' #import <FAPL/FAPL.h> ^ clang: error: unable to execute command: Segmentation fault: 11 clang: error: clang frontend command failed due to signal (use -v to see invocation) Apple clang version 12.0.0 (clang-1200.0.32.29) Target: x86_64-apple-ios10.0-simulator Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin clang: note: diagnostic msg: PLEASE submit a bug report to http://developer.apple.com/bugreporter/ and include the crash backtrace, preprocessed source, and associated run script. clang: error: unable to execute command: Segmentation fault: 11 clang: note: diagnostic msg: Error generating preprocessed source(s).
Posted
by
Post not yet marked as solved
0 Replies
392 Views
Hi, I've set the C++ language dialect in my project to c++2a. Than it failed on compiling .mm file which has the following line @import AppKit; But if replace it with the following line and link with framework from project build phases, than it works. #import <AppKit/AppKit.h> My .mm file is including for adapter swift header file (*-Swift.h) which is auto generated and has this @import directive. is it a known issue, should I file a bug ?
Posted
by
Post not yet marked as solved
1 Replies
620 Views
I use clang 12 to build some cpp project that needs semaphore.acquire() function. System version: MacOs Big Sur 12.0 However, Compiler shows that some function is unavailable. Detail messages: /concurrencpp/source/executors/worker_thread_executor.cpp:42:21: error: 'acquire' is unavailable [build] m_semaphore.acquire(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:202:10: note: 'acquire' has been explicitly marked unavailable here [build] void acquire() [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:106:21: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:121:21: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/worker_thread_executor.cpp:160:17: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:218:26: error: 'try_acquire_until' is unavailable [build] if (!m_semaphore.try_acquire_until(deadline)) { [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:219:10: note: 'try_acquire_until' has been explicitly marked unavailable here [build] bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:218:26: error: 'try_acquire_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000>>>' is unavailable [build] if (!m_semaphore.try_acquire_until(deadline)) { [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:219:10: note: 'try_acquire_until<std::__1::chrono::steady_clock, std::__1::chrono::duration<long long, std::__1::ratio<1, 1000000000>>>' has been explicitly marked unavailable here [build] bool try_acquire_until(chrono::time_point<Clock, Duration> const& __abs_time) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:322:25: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] /Users/mirocos/master/study/concurrencpp/source/executors/thread_pool_executor.cpp:420:17: error: 'release' is unavailable [build] m_semaphore.release(); [build] ^ [build] /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/semaphore:197:10: note: 'release' has been explicitly marked unavailable here [build] void release(ptrdiff_t __update = 1) [build] ^ [build] 4 errors generated. can anyone could help me with it?
Posted
by
Post not yet marked as solved
0 Replies
493 Views
In file included from /Users/xx/Desktop/xx/Pods/xx/xx/Classes/xx/Utils/xx/xx.mm:9: In file included from /Users/xx/Desktop/xx/Pods/xx/xx/Classes/xx/Utils/xx/xx.h:13: In file included from /Users/tang/Desktop/xx/Pods/Headers/Private/GPUImage/GPUImage.h:7: In file included from /Users/tang/Desktop/xx/Pods/Headers/Private/GPUImage/GPUImageVideoCamera.h:2: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h:23: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFCapture.h:21: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVDepthData.h:11: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCameraCalibrationData.h:12: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/simd/matrix_types.h:33: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/simd/vector_make.h:5310: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/c++/v1/tuple:149: /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/c++/v1/__tuple:24:1: error: templates must have C++ linkage template struct _LIBCPP_TEMPLATE_VIS tuple_size; ^~~~~~~~~~~~~~~~~~~~ In file included from /Users/tang/Desktop/xx/Pods/xx/xx/Classes/xx/Utils/xx/xx.mm:9: /Users/tang/Desktop/xx/Pods/xx/xx/Classes/xx/xx/xx/xx.h:11:1: note: extern "C" language linkage specification begins here extern "C" { ^ In file included from /Users/xx/Desktop/xx/Pods/xx/xx/Classes/xx/Utils/xx/xx.mm:9: In file included from /Users/tang/Desktop/xx/Pods/TempBase/TempBase/Classes/xx/Utils/xx/xx.h:13: In file included from /Users/tang/Desktop/xx/Pods/Headers/Private/GPUImage/GPUImage.h:7: In file included from /Users/tang/Desktop/xx/Pods/Headers/Private/GPUImage/GPUImageVideoCamera.h:2: In file included from /Users/xx/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFoundation.h:23: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVFCapture.h:21: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVDepthData.h:11: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCameraCalibrationData.h:12: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/simd/matrix_types.h:33: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/simd/vector_make.h:5310: In file included from /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/c++/v1/tuple:149: /Users/tang/Downloads/Xcode-beta.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.0.sdk/usr/include/c++/v1/__tuple:27:1: error: templates must have C++ linkage template <class _Tp, class...>
Posted
by
Post not yet marked as solved
0 Replies
404 Views
In our project we use these flags: OTHER_SWIFT_FLAGS = "-driver-time-compilation -Xfrontend -debug-time-compilation -Xfrontend -debug-time-function-bodies -Xfrontend -debug-time-expression-type-checking"; After Xcode updating from 12.4 to 12.5.1 we started receiving error : <unknown>:0: error: unknown argument: '-debug-time-compilation' Command CompileSwift failed with a nonzero exit code What could be the problem?
Posted
by
Post not yet marked as solved
1 Replies
290 Views
Does enabling or disabling bitcode would affect the existing features of the app in any way ? For eg: If I choose to untick the option "Rebuild from bitcode" while sharing the ipa to QA team and on the other hand If I chose to enable bitcode when I am uploading the app to AppStore. Is there any possibility that the some test cases might go live untested ?
Posted
by
Post not yet marked as solved
0 Replies
343 Views
I'm using Apple Clang on macOS 11.5.2. When I try to compile the following code: #include <fstream> #include <iostream> #include <filesystem> int main() { const std::filesystem::path sandbox{"sandbox"}; std::ofstream{sandbox/"file1.txt"}; std::ofstream{sandbox/"file2.txt"}; std::cout << "directory_iterator:\n"; for(auto const& dir_entry: std::filesystem::directory_iterator{sandbox}) std::cout << dir_entry << '\n'; std::filesystem::remove_all(sandbox); } Via the command clang++ foo.cpp -std=c++17 , I get: foo.cpp:13:19: error: invalid operands to binary expression ('std::__1::ostream' (aka 'basic_ostream<char>') and 'const std::__1::__fs::filesystem::directory_entry') std::cout << dir_entry << '\n';
Posted
by
Post not yet marked as solved
0 Replies
219 Views
Hello, the following code behaves different in debug and release mode. The debug output is correct while in release mode it seems that there is no integer overflow and instead the value is calculated with a 64 bit value. @ Apple: can you confirm it? #include <iostream> #include <string> //------------------------------------------------------------------------ int main () { signed long long checkSum {14120563136728876}; int i = 23342251; std::string theString {"\\"}; // one ch is working, one is not // compare by using the first one or the second one // unsigned char ch {0b01011100}; // 92 unsigned char ch = theString[0]; // 92 checkSum += (int)ch * (i + 1); // different result in Debug and Release Mode std::cout << checkSum << "\n"; return 0; }
Posted
by