Looks some GO compiler bug. Please see below for more details to validate and confirm about bug.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

Readme.md 2.6KB

il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
il y a 2 ans
  1. **Looks some GO compiler bug.**
  2. [Github Issue Link](https://github.com/golang/go/issues/43661)
  3. Please see below for more details to validate and confirm about bug.
  4. A bug which occurs only in plugins with assembly code.
  5. The package consists of a bn256 crypto implementation which has amd64 assembly code and also a generic implementation.
  6. The assembly implementation is default and generic implementation can be enabled using the "generic" tag.
  7. The plugin when compiled as a binary runs **OK** with both assembly and go implementation.
  8. The plugin when compiled as a plugin **FAILS** with assembly code but runs OK with generic implementation.
  9. As far as my understanding goes, everything should be running okay.
  10. **Please see attached source code and test on x86_64 linux system.**
  11. `go version : 1.15.7` ( However go version 1.14 and 1.16beta1 also show same error behaviour.)
  12. `OS: linux x86_64`
  13. My initial guess is some sort of corruption ( Or wrong code generation) by the go compiler/assembler.
  14. **TESTING:**
  15. ```
  16. #Run plugin directly to see correct result.
  17. go run plugin/plugin.go
  18. #Compile as plugin.
  19. go build -buildmode=plugin -o /tmp/plugin.so ../compiler_bug/plugin/
  20. #Running plugin will trigger error
  21. go run runplugin/main.go
  22. ```
  23. However, if the plugin is compiled with generic tag (To disable asm code, the bug doesn't occur), Some register corruption occurs due to wrong code being generated.
  24. `go build -buildmode=plugin -tags generic -o /tmp/plugin.so ../compiler_bug/plugin/`
  25. **Running plugin will not cause an error.**
  26. `go run runplugin/main.go`
  27. Maybe to detect such case, test cases can also be run in plugin mode to detect such cases.
  28. This can be done by adding another argument to go test for plugin mode testing.
  29. **Actual behaviour:**
  30. ```
  31. ./demo.sh
  32. Actual a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  33. Expected a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  34. running plugin
  35. panic: Decode point err bn256: malformed point err
  36. goroutine 1 [running]:
  37. _/tmp/compiler_bug/plugin.Export()
  38. /tmp/compiler_bug/plugin/plugin.go:23 +0x2d7
  39. main.main()
  40. /tmp/compiler_bug/runplugin/main.go:24 +0x107
  41. exit status 2
  42. ```
  43. **Expected behaviour:**
  44. ```
  45. ./demo.sh
  46. Actual a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  47. Expected a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  48. running plugin
  49. Actual a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  50. Expected a01f9bcc1208dee302769931ad378a4c0c4b2c21b0cfb3e752607e12d2b6fa6425
  51. ```
  52. **demo.sh is included in the repo to recreate the bug easily.**