diff --git a/test_regress/t/t_dpi_context_c.cpp b/test_regress/t/t_dpi_context_c.cpp index 4839f4b9e..12494fcd8 100644 --- a/test_regress/t/t_dpi_context_c.cpp +++ b/test_regress/t/t_dpi_context_c.cpp @@ -92,7 +92,14 @@ int dpic_save(int value) { return 0; } - if (svPutUserData(scope, &Dpic_Unique, (void*)(value))) { + // Use union to avoid cast to different size pointer warnings + union valpack { + void* ptr; + int i; + } vp; + + vp.i = value; + if (svPutUserData(scope, &Dpic_Unique, vp.ptr)) { printf("%%Warning: svPutUserData failed\n"); return 0; } @@ -106,8 +113,14 @@ int dpic_restore() { return 0; } - if (void* userp = svGetUserData(scope, &Dpic_Unique)) { - return (int)(long long)(userp); + if (void* userp = svGetUserData(scope, (void*)&Dpic_Unique)) { + // Use union to avoid cast to different size pointer warnings + union valpack { + void* ptr; + int i; + } vp; + vp.ptr = userp; + return vp.i; } else { printf("%%Warning: svGetUserData failed\n"); return 0; diff --git a/test_regress/t/t_sys_file_scan.v b/test_regress/t/t_sys_file_scan.v index e94e580ea..1bb4ea4a6 100644 --- a/test_regress/t/t_sys_file_scan.v +++ b/test_regress/t/t_sys_file_scan.v @@ -15,13 +15,14 @@ module t; count = 1234; `ifdef TEST_VERBOSE - $display("-count == %d, infile %d, outfile %d", count, infile, outfile); + $display("-count == %0d, infile %d, outfile %d", count, infile, outfile); `endif count = $fscanf(infile, "%d\n", a); `ifdef TEST_VERBOSE // Ifdefing this out gave bug248 - $display("-count == %d, infile %d, outfile %d", count, infile, outfile); + $display("-count == %0d, infile %d, outfile %d", count, infile, outfile); `endif + if (count == 0) $stop; $fwrite(outfile, "# a\n"); $fwrite(outfile, "%d\n", a); $fclose(infile);