问题标签 [illegal-instruction]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
22458 浏览

g++ - “非法指令:4”出现在 OS X Lion 中

一些 C++ 应用程序在 OS X Snow Leopard 中无缝编译和运行,但我最近更改为 OS X Lion,在这里,虽然没有编译错误,但当我尝试运行它时,我收到错误“非法指令:4”,我不知道,可能是什么原因?

PS:

这些是我使用的链接标志

这是我做的时候得到的输出sudo truss executable

PS2:如果我删除前面提到的链接标志,程序运行,没有错误。但是当我向程序输入真实数据时,我得到

我记得这个程序的堆栈有问题,所以不得不增加它。在Linux中,我做到了这一点并且可以工作

但是在 OS X 中,由于那不起作用,我使用了前面提到的链接标志,并且没有问题是 OS X Snow Leopard,所以我在 OS X Lion 中似乎仍然存在堆栈溢出问题,但链接标志并没有解决这。我能做什么?

0 投票
1 回答
219 浏览

assembly - Intel VEX 前缀,L 位值不按照文档表现

英特尔指令集参考为我们提供了添加指令:

我们可以看到 L 位被忽略(可以是 0 或 1)。

addd xmm0, xmm0, xmm0的机器码:0xC4, 0xE1, 0x7B, 0x58, 0xC0

让我们测试一下:

很好,视觉工作室反汇编程序也可以识别指令。

但是,当我将L 位更改为 1(0x7B 替换为 0x7F)时,反汇编程序无法识别指令并生成无效指令异常。这是否意味着尽管英特尔手册 L 位必须始终为 0?

0 投票
1 回答
733 浏览

macos - Keras Illegal instruction 4 on el capitan

嗨,我正在使用 keras 制作神经网络分类器的原型。我使用了成功运行另一台 Mac 机器的代码,但是当我尝试在我的 iMac 上运行它时,它会出现以下错误消息:

“非法指令:4”

从互联网上收集到,这似乎是 theano 和我使用的 mac OS 版本的问题,即 El Capitan 的最新版本 10.11.6。有没有简单的方法来解决这个问题。我读到您可以在旧版本上运行编译器,但我不太确定该怎么做。

谢谢

0 投票
2 回答
512 浏览

assembly - 启用 AVX2 的处理器上的非法指令 vgatherdps

我正在为 AVX2 指令开发代码生成器,并尝试在 AMD A10 8700 处理器上对其进行测试,根据规格,它应该运行 AVX2。

但是,它会因 vgatherdps 指令中的非法指令而崩溃:

cpuid 信息表明包含 avx2,因此 VGATHERDPS 应该是合法的。

有什么线索吗?

0 投票
2 回答
1356 浏览

python - 将库运行到 python 时出错

我按照http://npatta01.github.io/2015/08/10/dlib/的步骤操作,但是当我尝试运行时(我使用 sudo),

收回错误。首先,错误是

到第 8 行。现在,错误是,Illegal instruction (core dumped)但我不知道为什么。请帮我正确添加库。

0 投票
0 回答
459 浏览

assembly - “66 66 90”(data32 data32 nop)是 64 位长模式下英特尔 cpu 的有效指令吗?

我在 64 位 Intel Xeon 处理器上收到非法操作码。当异常发生时,%rip 指向指令序列66 66 90。根据我读过的内容(例如,这篇文章),这是一个多字节 NOP。该文章似乎暗示多字节 NOP 的首选/强制字节序列可能在 Intel ( 0F 1F mod-000-rm) 和 AMD ( 66 ... 90) 之间有所不同。谁能告诉我 1)这两种形式是否可以在任一处理器上使用,以及 2)是否存在特定的处理器模式,其中多字节 NOP 会生成无效的操作码异常?

0 投票
1 回答
1056 浏览

linux - 执行 glibc 的 ld-2.6.1.so 时收到“非法指令”

背景

“操作系统”:精简 Linux,非常定制,无法访问互联网(没有 yum、apt-get 等)

内核:2.6.19.1

目标:32 位,armv5te

当前的 LibC:2.3.6

目标 LibC:2.6.1

问题

从第 3 方供应商处收到一份.ipk包含glibc. 首先调查.ipk包中包含的共享对象的兼容性,方法是将它们放在目标平台上并尝试ld-2.6.1.so直接运行(选择这个库,因为我的理解是它没有与其他对象的动态链接)。

直接运行此共享对象库会导致“非法指令”。我最初的想法是它ld是为错误的架构而构建的,但是,对readelf输出的审查似乎表明它设置正确:

我的下一个想法是我知道glibc提供了一个内核接口,所以它可能期望一个不同于2.6.19.1. 但是我不确定如何确定内核ld的目标版本。

我可以根据要求发布更多信息,对任何和所有想法开放。提前致谢。

0 投票
1 回答
1223 浏览

c++ - bit-shift illegal instruction in 64-bit release mode only

I am integrating the PoissonRecon code available here into my own mesh manipulation code, but I've been unable to compile the integrated code in x64 because of an "illegal instruction" error in every bit-shift instruction in the Poisson code's octree generation.

I'm using Visual Studio 2015 and my issue occurs only when compiled in x64 and only when in release mode (i.e., it works in x86 debug and release as well as x64 debug).

As an example of one of the bitshift instructions, the following is defined at the top of Octree.inl:

And these variables are used in the following function:

This function breaks at the line

which I've split down further and found that the issue is the bit-shift itself, i.e. (var)<<OffsetShift1; but this causes an "illegal instruction" error.

Note that OffsetShift1 is simply "5", so this is equivalent to (var)<<5; which does work as expected.

A possible workaround is to simply #define all of these variables at the top (which does fix the issue), but this does not solve other bit-shift issues such as the following:

I've tried to static_cast<long long> everything, but it's not an overflow issue. Even stranger, if I break before a bit-shift (while in release mode) and then highlight the operation, the debugger tells me the correct result (for example, d = 5 in _startAndWidth, so 1 << d returns 32 in the debugger) but actually stepping over the operation causes an "illegal instruction" error.

Since the program works correctly in debug mode, I've tried removing all optimizations in release mode, but I still get the same error. The only workaround I've found is to replace all bit-shift operations with pow() instead, and while that works, it seems a bit ridiculous.

0 投票
0 回答
528 浏览

c++ - 非法指令 - vcvtsi2sd

我正在编写一个程序来使用库FGB计算 Groebner 基。虽然它有一个 C 接口,但我在 Ubuntu 上从用 g++ 编译的 C++ 代码调用该库。

使用选项-g编译,在gdb中使用x/i $pc,非法指令如下。

0x421c39 FGb_xmalloc_spec+985: vcvtsi2sd %rbx,%xmm0,%xmm0

上面的行在 FGB_xmalloc_spec+985 周围有尖括号。据我所知,我的处理器不支持这条指令,我正试图找出程序使用它的原因。在我看来,该指令来自库代码。但是,我正在编译的代码曾经在桌面上工作,现在它失败了——有一天刚刚开始抛出非法指令。我以为我搞砸了一些库或其他东西,所以我重新安装了 Ubuntu 16.04,但我继续收到非法指令。相同的代码确实适用于另一个桌面和 chromebook,分别运行 Ubuntu 16.04 和 14.04。

技术信息:

  • g++:5.4.0 20160609
  • gdb:7.11.1
  • Ubuntu:16.04/14.04 LTS
  • 进程:x86info 输出

    找到 4 个相同的 CPU 扩展系列:0 扩展型号:1 系列:6 型号:23 步进:10 类型:0(原始 OEM) CPU 型号(x86info 的最佳猜测):Core 2 Duo 处理器名称字符串(BIOS 编程):Intel(R ) Core(TM)2 四核 CPU Q9650 @ 3.00GHz

  • 处理器标志

    fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good nopl aperfmperf pni dtes64 monitor ds_cpl pdscmx sstmx cstpr6 sse4_1 xsave lahf_lm tpr_shadow vnmi flexpriority dtherm

  • 编译行

    g++ -std=c++11 -g -I src -o bin/main.o -c src/main.cpp

    g++ -std=c++11 -g -I src -o bin/Polynomial.o -c src/Polynomial.cpp

    g++ -std=c++11 -g -I src -o bin/Util.o -c src/Util.cpp

    g++ -std=c++11 -g -I src -o bin/Solve.o -c src/Solve.cpp

    g++ -std=c++11 -g -o bin/StartUp bin/main.o bin/Util.o bin/Polynomial.o bin/Solve.o -Llib -lfgb -lfgbexp -lgb -lgbexp -lminpoly -lminpolyvgf - lgmp -lm -fopenmp

在这一点上,我不确定我还能做些什么来避免这种非法指令,并欢迎任何和所有建议。

0 投票
1 回答
4013 浏览

windows - 使用 WinDbg 调试 0xc000001d 异常

我正在尝试使用 WinDbg 查找“非法指令”异常 (0xc000001d) 的根本原因。该项目是用 VC++2015 构建的。我从两次测试运行中得到了两次内存转储。

现在,我发现这两个转储都是正确的:

  • 异常指向“ movq mmword ptr [ecx], xmm0”指令
  • xmm0 包含零
  • 异常发生在对象构造函数中
  • 地址在 DS 内
  • 地址属于看起来有效的堆条目
  • 指向对象的地址正在被构造,所以它似乎试图将零赋给看起来也有效的 obj.m_data 成员

我不知道去哪里更远,所以我会很感激任何指示。

升级版: