Opened 5 years ago
Closed 5 years ago
#168 closed ожидается проверка (задача сдана)
WW#2
Reported by: | gabitov.daniil | Owned by: | Артур Гулецкий (huletski) |
---|---|---|---|
Component: | WW_strings | Version: | 3.0 |
Keywords: | Cc: |
Description
Change History (9)
comment:1 Changed 5 years ago by
Type: | ожидается проверка → ожидаются исправления |
---|
comment:2 Changed 5 years ago by
Type: | ожидаются исправления → ожидается проверка |
---|---|
Version: | 1.0 → 2.0 |
Криво загрузил проект в SVN.
comment:3 Changed 5 years ago by
Type: | ожидается проверка → ожидаются исправления |
---|
my_strlen
, my_strcpy
- ok, +5. В остальных баги -> нужно больше тестов.
Кроме того, по условию main
должна находиться в test.c
, у вас же она лежит в test_str.c
-> -1 балл.
--
Итог: 4, исправляйте, чтобы получить больше.
Подсказка: если не хочется писать тесты и искать баги, подумайте как можно реализовать поломанный strcat через вызов "целых" strcpy и strlen.
comment:4 Changed 5 years ago by
Type: | ожидаются исправления → ожидается проверка |
---|---|
Version: | 2.0 → 3.0 |
Исправления.
comment:5 Changed 5 years ago by
Type: | ожидается проверка → ожидаются исправления |
---|
О работающем:
my_strcmp
победили -> +2;- тесты вызываются как просили -> +1.
Все еще не работает:
my_strcat
. Запустите на непустой и пустой строке, например. И прислушайтесь, плз, к подсказке в предыдущем комментарии: реализуйте функцию через уже работающие;- в некоторых тестах у вас неверные размеры буферов, что приводит к их переполнению. При отладке добавьте флаг
-fsanitize=address
для компиляции и линковки - gcc "понадобавляет проверок" на переполнение - и запустите тесты для того, чтобы обнаружить ошибку.
--
Итог: 7, чините my_strcat
и работу с памятью в тестах.
comment:6 Changed 5 years ago by
Type: | ожидаются исправления → ожидается проверка |
---|
comment:7 Changed 5 years ago by
Type: | ожидается проверка → ожидаются исправления |
---|
Плохие новости
Не могу собрать решение:
{lab_02}[2338]$ pwd && svn up && svn status /home/hfx/dvl/cpp19/gabitov.daniil/lab_02 Updating '.': At revision 814. {lab_02}[2339]$ make mkdir obj gcc -c -Wall -Wextra -Werror -std=c99 -fsanitize=address -o obj/str.o src/str.c -Iinclude gcc -c -Wall -Wextra -Werror -std=c99 -fsanitize=address -o obj/test_str.o src/test_str.c -Iinclude gcc -c -Wall -Wextra -Werror -std=c99 -fsanitize=address -o obj/test.o src/test.c -Iinclude gcc obj/str.o obj/test_str.o obj/test.o -o lab_02 obj/str.o: In function `my_strcpy': str.c:(.text+0x4d): undefined reference to `__asan_report_load1' str.c:(.text+0x89): undefined reference to `__asan_report_store1' str.c:(.text+0xcd): undefined reference to `__asan_report_load1' str.c:(.text+0x110): undefined reference to `__asan_report_store1' obj/str.o: In function `my_strlen': str.c:(.text+0x16f): undefined reference to `__asan_report_load1' obj/str.o: In function `my_strcmp': str.c:(.text+0x1cf): undefined reference to `__asan_report_load1' str.c:(.text+0x20e): undefined reference to `__asan_report_load1' str.c:(.text+0x263): undefined reference to `__asan_report_load1' str.c:(.text+0x29f): undefined reference to `__asan_report_load1' obj/str.o:str.c:(.text+0x2e8): more undefined references to `__asan_report_load1' follow obj/str.o: In function `_GLOBAL__sub_I_00099_0_my_strcpy': str.c:(.text+0x39a): undefined reference to `__asan_init' str.c:(.text+0x39f): undefined reference to `__asan_version_mismatch_check_v8' obj/test_str.o: In function `test_strcpy': test_str.c:(.text+0x1e): undefined reference to `__asan_option_detect_stack_use_after_return' test_str.c:(.text+0x2b): undefined reference to `__asan_stack_malloc_1' test_str.c:(.text+0xfe): undefined reference to `__asan_report_store_n' test_str.c:(.text+0x138): undefined reference to `__asan_report_store1' test_str.c:(.text+0x17e): undefined reference to `__asan_report_load1' test_str.c:(.text+0x18b): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0x1d3): undefined reference to `__asan_report_store1' test_str.c:(.text+0x23b): undefined reference to `__asan_report_store_n' test_str.c:(.text+0x2a6): undefined reference to `__asan_report_load1' test_str.c:(.text+0x2b9): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0x311): undefined reference to `__asan_report_load1' obj/test_str.o: In function `test_strcat': test_str.c:(.text+0x3b1): undefined reference to `__asan_option_detect_stack_use_after_return' test_str.c:(.text+0x3be): undefined reference to `__asan_stack_malloc_1' test_str.c:(.text+0x45c): undefined reference to `__asan_report_store4' test_str.c:(.text+0x492): undefined reference to `__asan_report_store4' test_str.c:(.text+0x4f8): undefined reference to `__asan_report_load1' test_str.c:(.text+0x519): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0x561): undefined reference to `__asan_report_store1' test_str.c:(.text+0x594): undefined reference to `__asan_report_store4' test_str.c:(.text+0x5f2): undefined reference to `__asan_report_load1' test_str.c:(.text+0x605): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0x65d): undefined reference to `__asan_report_load1' obj/test_str.o: In function `test_strlen': test_str.c:(.text+0x6fd): undefined reference to `__asan_option_detect_stack_use_after_return' test_str.c:(.text+0x70a): undefined reference to `__asan_stack_malloc_1' test_str.c:(.text+0x79c): undefined reference to `__asan_report_store1' test_str.c:(.text+0x7c1): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0x83e): undefined reference to `__asan_report_store_n' test_str.c:(.text+0x86b): undefined reference to `__asan_handle_no_return' obj/test_str.o: In function `test_strcmp': test_str.c:(.text+0x90f): undefined reference to `__asan_option_detect_stack_use_after_return' test_str.c:(.text+0x91c): undefined reference to `__asan_stack_malloc_1' test_str.c:(.text+0x9ba): undefined reference to `__asan_report_store4' test_str.c:(.text+0xa25): undefined reference to `__asan_report_store_n' test_str.c:(.text+0xa57): undefined reference to `__asan_handle_no_return' test_str.c:(.text+0xa9f): undefined reference to `__asan_report_store4' test_str.c:(.text+0xad5): undefined reference to `__asan_report_store4' test_str.c:(.text+0xb03): undefined reference to `__asan_handle_no_return' obj/test_str.o: In function `_GLOBAL__sub_D_00099_0_test_strcpy': test_str.c:(.text+0xb9b): undefined reference to `__asan_unregister_globals' obj/test_str.o: In function `_GLOBAL__sub_I_00099_1_test_strcpy': test_str.c:(.text+0xba6): undefined reference to `__asan_init' test_str.c:(.text+0xbab): undefined reference to `__asan_version_mismatch_check_v8' test_str.c:(.text+0xbba): undefined reference to `__asan_register_globals' obj/test.o: In function `_GLOBAL__sub_I_00099_0_main': test.c:(.text+0x38): undefined reference to `__asan_init' test.c:(.text+0x3d): undefined reference to `__asan_version_mismatch_check_v8' collect2: error: ld returned 1 exit status Makefile:6: recipe for target 'lab_02' failed make: *** [lab_02] Error 1
Забыли включить sanitizer при линковке (а у вас решение собирается?).
Хорошие новости
my_strcat
преобразилась. Раз уж надо будете чинить сборку, может еще подумаете, как от цикла избавиться? Может что-то к s1 можно прибавить, чтобы переместить указатель сразу в нужную позицию?
comment:8 Changed 5 years ago by
Type: | ожидаются исправления → ожидается проверка |
---|
comment:9 Changed 5 years ago by
Resolution: | → задача сдана |
---|---|
Status: | assigned → closed |
Заработало, +10.
Не могу собрать решение:
Папка
obj
в решении лишняя.