哪些编译器对生成的 asm 代码提供保证担保?

问题描述

请注意,问题是关于一般编译器,而不是针对任何特定的编程语言。

上下文:正如我们所知,像 gcc 和 Clang (LLVM) 这样的编译器不会通过显式指定对生成的 asm 代码提供任何保证(担保):

gcc:

没有保修;甚至不是为了特定目的的适销性或适用性。

Clang (LLVM):

LLVM 根本没有任何保证。

问题:有哪些已知的(我猜主要是商业)编译器确实生成的 asm 代码提供保证(担保)的例子?他们究竟提供哪些保证?究竟是哪种类型的保证?

示例 1. 保证在使用相应操作(例如,浮点运算)的地方(它的源代码)将总是生成某个硬件指令。 IE。这些操作将永远优化为专用硬件指令将被其他一些硬件指令(或它们的组合)替换。

示例 2. 选项及其组合。保证任何可能的选项组合总是导致这些选项的预期累积效果。 IE。 没有提供的选项将被静跳过而不生成诊断消息。

UPD1。 # example from https://www.learnpyqt.com/tutorials/multithreading-pyqt-applications-qthreadpool/ from PyQt5.QtGui import * from PyQt5.QtWidgets import * from PyQt5.QtCore import * import time import traceback,sys from PyQt5 import Qt print("Python version: {}".format(sys.version)) print("Version info: {}".format(sys.version_info)) print("Qt version:",Qt.QT_VERSION_STR) print("PyQt version:",Qt.PYQT_VERSION) class WorkerSignals(QObject): finished = pyqtSignal() error = pyqtSignal(tuple) result = pyqtSignal(object) progress = pyqtSignal(int) class Worker(QRunnable): def __init__(self,fn,*args,**kwargs): super(Worker,self).__init__() # Store constructor arguments (re-used for processing) self.fn = fn self.args = args self.kwargs = kwargs self.signals = WorkerSignals() # Add the callback to our kwargs self.kwargs['progress_callback'] = self.signals.progress @pyqtSlot() def run(self): ''' Initialise the runner function with passed args,kwargs. ''' # Retrieve args/kwargs here; and fire processing using them try: result = self.fn(*self.args,**self.kwargs) except: traceback.print_exc() exctype,value = sys.exc_info()[:2] self.signals.error.emit((exctype,value,traceback.format_exc())) else: self.signals.result.emit(result) # Return the result of the processing finally: self.signals.finished.emit() # Done class MainWindow(QMainWindow): def __init__(self,**kwargs): super(MainWindow,self).__init__(*args,**kwargs) self.counter = 0 layout = QVBoxLayout() self.l = QLabel("Start") b = QPushButton("DANGER!") b.pressed.connect(self.oh_no) layout.addWidget(self.l) layout.addWidget(b) w = QWidget() w.setLayout(layout) self.setCentralWidget(w) self.show() self.threadpool = QThreadPool() print("Multithreading with maximum %d threads" % self.threadpool.maxThreadCount()) self.timer = QTimer() self.timer.setInterval(1000) self.timer.timeout.connect(self.recurring_timer) self.timer.start() def progress_fn(self,n): # trigger exception deliberately here a = [] idx = 0 try: testtrig = a[idx] except: from PyQt5.QtCore import pyqtRemoveInputHook import pdb,traceback pyqtRemoveInputHook() extype,tb = sys.exc_info() traceback.print_exc() #pdb.post_mortem(tb) pdb.set_trace() print("%d%% done" % n) def execute_this_fn(self,progress_callback): for n in range(0,5): time.sleep(1) progress_callback.emit(int(n*100/4)) return "Done." def print_output(self,s): print(s) def thread_complete(self): print("THREAD COMPLETE!") def oh_no(self): # Pass the function to execute worker = Worker(self.execute_this_fn) # Any other args,kwargs are passed to the run function worker.signals.result.connect(self.print_output) worker.signals.finished.connect(self.thread_complete) worker.signals.progress.connect(self.progress_fn) # Execute self.threadpool.start(worker) def recurring_timer(self): self.counter +=1 self.l.setText("Counter: %d" % self.counter) app = QApplication([]) window = MainWindow() app.exec_() 在这里表示始终提供广告(声称)功能的能力。 IE。没有任何隐藏的影响,无声行为(不生成任何诊断消息),用其他硬件指令替换一个硬件指令(因此,您不能提前说,生成的汇编代码中将包含哪些硬件指令),等等--你明白了。

如果它不做 X,他们承诺会尝试修复它?

至少。

正确性的数学证明?

最好。然而,据我所知,经过数学验证的软件开发工具的价格很高。你确认吗?并且只有特定的软件项目需要使用经过数学​​验证的软件开发工具。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)