Comments (12)
https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
Compiling with -fsanitize=return
should help too.
from codewars-runner-cli.
Looks like the -O2
flag that was added is messing with the test framework. If I remove that flag, the test fails the same way as C++14 version with exit code 132
(Illegal Instruction).
For "Last digit of a huge number", solution without body crashes in random tests (segfaults).
from codewars-runner-cli.
For "Last digit of a huge number", solution without body crashes in random tests (segfaults).
But passes "TEST".
from codewars-runner-cli.
I know, I'm just listing my observations. It seems to be caused by -O2
flag like I wrote above.
from codewars-runner-cli.
Not returning a value from a function is undefined behavior, which gives the compiler freedom to do anything, not necessarily to return an unspecified value, so, apparently, the function has been optimized to always return what is expected (and Clang is known for sophisticated optimization as in famous https://kristerw.blogspot.com/2017/09/why-undefined-behavior-may-call-never.html). So it's not like something is wrong with the framework. I'm not sure what can be done about it though...
from codewars-runner-cli.
Amongst the kata I tried some pass and some rightly fail.
from codewars-runner-cli.
Yeah, you usually don't have optimization flag on while testing/developing. Most languages on Codewars doesn't have optimization/production flag on.
@g964 Why not just provide valid initial solution?
#include <list>
using namespace std;
int last_digit(list<int> array) {
// Write your code here
return 0; // <- added
}
This won't prevent users submitting by removing that line, but it should prevent accidental ones.
from codewars-runner-cli.
I think a wrapper with noinline may work, like
[[gnu::noinline]]
int last_digit_wrapper(list<int> array) {
return last_digit(array);
}
It seems that it works even without noinline in this kata, but it's probably less reliable.
from codewars-runner-cli.
Amongst the kata I tried some pass and some rightly fail.
Maybe those that fails have dotest
wrapper that you often use?
from codewars-runner-cli.
I didn't try any others kata of mine except the first I mentioned in my first post.
Examples:
https://www.codewars.com/kata/56c5847f27be2c3db20009c3/train/cpp rightly fails
https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/cpp "
https://www.codewars.com/kata/56bdd0aec5dc03d7780010a5/train/cpp "
https://www.codewars.com/kata/534d2f5b5371ecf8d2000a08/train/cpp passes
https://www.codewars.com/kata/5886e082a836a691340000c3/train/cpp "
https://www.codewars.com/kata/50654ddff44f800200000004/train/cpp "
from codewars-runner-cli.
@error256 Nice find! The kata fails with
main.cpp:9:5: runtime error: execution reached the end of a value-returning function without returning a value
I still think a valid initial solution returning the empty value should be provided though. So add return {};
/return 0;
/return std::string();
whatever that makes sense.
from codewars-runner-cli.
Deployed the fix.
from codewars-runner-cli.
Related Issues (20)
- Update default test setup for Coq HOT 1
- Nim tests incorrectly shown as passing when actually faliing HOT 3
- Add Dart 2.8 HOT 1
- Add Rust 1.44 HOT 1
- Add Haxe HOT 14
- Add Crystal 0.34 HOT 2
- Update Python math/scientific libraries HOT 1
- `mcheck` breaks every C kata in new language version HOT 2
- Add Lean v3.11.0 (with mathlib) HOT 6
- Add NodeJS 12 HOT 1
- Add possibility to use scala testing frameworks for java solutions HOT 1
- Rust test runner: Please support Codewars Output format too HOT 20
- Add bit_set to rust HOT 1
- Add Lean 3.16.3 HOT 6
- Haxe: Type not found : Int64 HOT 3
- Add Lean v3.18.4 HOT 9
- Exit code is 0 when crashing with memory error with Node 12 HOT 7
- CFML: java.lang.VerifyError:Expecting a stackmap frame at branch target HOT 5
- Add rest api documentation. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from codewars-runner-cli.