Ad
  • Custom User Avatar

    I'm completely stumped by exit code 139, presumably a segfault, running the sample tests in the web interface. I can't reproduce locally and valgrind/ubsan/asan don't see anything wrong in my code. My code does no heap allocations and the vector indexing in the sample tests dont overrun the vector. So haven't a clue. I'm using g++ 7.3 and clang++ 6.0.

    Not posting the solution code here (yet), but here's the steps I'm taking locally:

    $ g++ -Wall -Wno-deprecated-declarations -g -O2 -std=c++14 -I../igloo-igloo.1.1.1 cw_test.cpp -fsanitize=address,undefined -o cw
    cw_test.cpp: In member function ‘virtual void Tests::should_work_for_basic_relations()’:
    cw_test.cpp:14:35: warning: suggest parentheses around comparison in operand of ‘!=’ [-Wparentheses]
         bool res_5gtalt7neqa = (5 > a < 7 != a);
                                 ~~~~~~^~~
    $ ./cw
    ...
    Test run complete. 3 tests run, 3 succeeded, 0 failed.
    $ valgrind ./cw
    ==22141== Memcheck, a memory error detector
    ==22141== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
    ==22141== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
    ==22141== Command: ./cw
    ==22141== 
    ==22141==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
    ==22141== 
    ==22141== HEAP SUMMARY:
    ==22141==     in use at exit: 0 bytes in 0 blocks
    ==22141==   total heap usage: 0 allocs, 0 frees, 0 bytes allocated
    ==22141== 
    ==22141== All heap blocks were freed -- no leaks are possible
    ==22141== 
    ==22141== For counts of detected and suppressed errors, rerun with: -v
    ==22141== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
    
  • Custom User Avatar

    Good kata. You should have added sample tests with different comparison operators combined, e.g. i < 2*j > k or i == j <= k < l.

  • Custom User Avatar

    Good kata. But please add a sample test with a couple of intervals with negative values.

  • Custom User Avatar

    Solving this in C++ (MSVC 2017). Something wrong with this kata. Everything works fine locally, even for very long strings with long words. But here it fails with simplest input like "abc" or "abcd".