Fix public table offsets larger than 32 bits (#8135)

This commit is contained in:
Sunimali Rathnayake 2026-08-18 01:06:53 -05:00 committed by GitHub
parent 7dcd4e0b65
commit 2d8d8add42
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 30 additions and 2 deletions

View File

@ -354,3 +354,4 @@ Zixi Li
Zubin Jain
Àlex Torregrosa
Ícaro Lima
Sunimali Rathnayake

View File

@ -165,7 +165,7 @@ enum VerilatedVarFlags : uint32_t {
struct VlVarTableEntry final {
static constexpr int kMaxDims = 3; // Max packed+unpacked dims a table row holds
const char* namep; // VPI-facing (protected) variable name, string literal
uint32_t byteOffset; // offsetof of storage member from module instance base
size_t byteOffset; // offsetof of storage member from module instance base
VerilatedVarType vltype;
uint32_t vlflags; // Direction + flags (VLVD_*/VLVF_*)
uint8_t udims; // udims + pdims <= kMaxDims
@ -865,7 +865,7 @@ public: // But internals only - called from verilated modules, VerilatedSyms
// One scope, consumed by VerilatedScope::scopesConstructFromTable(); replaces
// per-scope 'new VerilatedScope{...}' statements, which compiles faster at scale.
struct VlScopeTableEntry final {
uint32_t ptrOffset; // offsetof of the target __Vscopep_* member within the Syms object
size_t ptrOffset; // offsetof of the target __Vscopep_* member within the Syms object
const char* namep; // Scope suffix name (protected), string literal
const char* identp; // Identifier with escapes removed (protected)
const char* defnamep; // Definition name (SCOPE_MODULE only), else "<null>"

View File

@ -0,0 +1,16 @@
#!/usr/bin/env python3
# DESCRIPTION: Verilator: Verilog Test driver/expect definition
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of either the GNU Lesser General Public License Version 3
# or the Perl Artistic License Version 2.0.
# SPDX-FileCopyrightText: 2026 Wilson Snyder
# SPDX-License-Identifier: LGPL-3.0-only OR Artistic-2.0
import vltest_bootstrap
test.scenarios('simulator')
test.compile(verilator_flags2=["--public-flat-rw -CFLAGS -Werror"])
test.passes()

View File

@ -0,0 +1,11 @@
// DESCRIPTION: Verilator: Test public variable offsets larger than 32 bits
//
// This file ONLY is placed under the Creative Commons Public Domain.
// SPDX-FileCopyrightText: 2026 Wilson Snyder
// SPDX-License-Identifier: CC0-1.0
module t;
longint padding1[1<<28];
longint padding2[1<<28];
longint padding3[1<<28];
endmodule