Age | Commit message (Collapse) | Author | Files | Lines |
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/604075
|
|
After CL 536643 passing NULL as the expected type permitted an untyped
constant expression to remain untyped. Change to passing the empty
interface type.
The panic and print/println functions are the only builtin functions
that turn an untyped constant expression into a regular function call,
and we already handled print/println specially.
The test case is https://go.dev/cl/603096.
Fixes golang/go#68734
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/603215
|
|
Patch by Rainer Orth <ro@gcc.gnu.org>.
Fixes PR go/106813
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/581724
|
|
<stdbool.h> has been available since C99. Use it rather than defining
our own boolean type and values.
Fixes https://gcc.gnu.org/PR114875
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/582275
|
|
This has apparently been wrong since I introduced the code ten years ago.
Fixes PR go/114500
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/574835
|
|
Fixes PR go/114463
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/574476
|
|
PR go/113668
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/560676
|
|
As we move toward generics, the error messages need to be able
to refer to types in a readable manner. Add that capability,
and use it today in AST dumps.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536716
|
|
PR go/113530
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/557655
|
|
Otherwise we can't tell the difference between builtin type "any" and
a locally defined type "any".
This will require updates to the gccgo export data parsers in the main
Go repo and the x/tools repo. These updates are https://go.dev/cl/537195
and https://go.dev/cl/537215.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536715
|
|
It is no longer used. The iota value is now handled in the
determine-types pass.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536644
|
|
This change moves the lowering pass after the type determination and
the type checking passes. This lets us simplify some of the code that
determines the type of an expression, which previously had to work
correctly both before and after type determination.
I'm doing this to help with future generic support. For example, with
generics, we can see code like
func ident[T any](v T) T { return v }
func F() int32 {
s := int32(1)
return ident(s)
}
Before this change, we would type check return statements in the
lowering pass (see Return_statement::do_lower). With a generic
example like the above, that means we have to determine the type of s,
and use that to infer the type arguments passed to ident, and use that
to determine the result type of ident. That is too much to do at
lowering time. Of course we can change the way that return statements
work, but similar issues arise with index expressions, the types of
closures for function literals, and probably other cases as well.
Rather than try to deal with all those cases, we move the lowering
pass after type checking. This requires a bunch of changes, notably
for determining constant types. We have to add type checking for
various constructs that formerly disappeared in the lowering pass.
So it's a lot of shuffling. Sorry for the size of the patch.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536643
|
|
The libgo/configure.ac file in upstream GCC was changed in
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=6a6d3817afa02bbcd2388c8e005da6faf88932f1
This adds an automake conditional that is not used, but will be used
in the future when and if libgo is ported to Darwin.
This CL makes the corresponding change in this repo.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/546435
|
|
This is a mechanical change to move Selector_expression up in expressions.cc.
This will make it visible to Builtin_call_expression for later work.
This produces a very large "git --diff", but "git diff --minimal" is clear.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536642
|
|
This changes the Expression {numeric,string,boolean}_constant_value
methods non-const. This does not affect anything immediately,
but will be useful for later CLs in this series.
The only real effect is to Builtin_call_expression::do_export,
which remains const and can no longer call numeric_constant_value.
But it never needed to call it, as do_export runs after do_lower,
and do_lower replaces a constant expression with the actual constant.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536641
|
|
This is a boilerplate change to pass gogo to Runtime::make_call.
It's not currently used but will be used by later CLs in this series.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536640
|
|
This method is not currently used by anything, but it will be used
by later CLs in this series.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536639
|
|
The gofrontend incorrectly accepted code that was missing a type conversion.
The test case for this is bug518.go in https://go.dev/cl/536537.
Future CLs in this series will detect the type error.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536638
|
|
The last caller was removed in https://go.dev/cl/18261 in 2016.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536637
|
|
It's not used for anything.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536636
|
|
Also pass Gogo to the type verification pass.
This is a refactoring that does not change the compiler behavior.
This is in preparation for future CLs that rearrange the pass ordering.
This introduces one new call to go_get_gogo, which will be removed in
a future CL.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/536635
|
|
Patch from Thomas Schwinge.
PR testsuite/109951
* configure.ac: 'AC_SUBST(SYSROOT_CFLAGS_FOR_TARGET)'.
* Makefile.in: Regenerate.
* configure: Likewise.
* testsuite/Makefile.in: Likewise.
* testsuite/lib/libgo.exp (libgo_init): If
'--with-build-sysroot=[...]' was specified, use it for build-tree
testing.
* testsuite/libgo-test-support.exp.in (GOC_UNDER_TEST): Don't set.
(SYSROOT_CFLAGS_FOR_TARGET): Set.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/527755
|
|
Handle the AR environment variable, used by gccgo,
the same way we handle the CC environment variable.
This ports https://go.dev/cl/526275 to the gofrontend repo.
This is needed for gccgo testing because the top-level GCC Makefile
now passes a --plugin option to ar if it supports one.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/526295
|
|
They are already collected via cmd/cgo.
The gccgo_link_c test is tweaked to do real linking as with this
change the cgo ldflags are not fully reflected in go build -n output,
since they now only come from the built archive.
This is a backport of https://go.dev/cl/497117 from the main repo.
For golang/go#60287
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/511675
|
|
* lang.opt (fgo-importcfg): New option.
* go-c.h (struct go_create_gogo_args): Add importcfg field.
* go-lang.cc (go_importcfg): New static variable.
(go_langhook_init): Set args.importcfg.
(go_langhook_handle_option): Handle -fgo-importcfg.
* gccgo.texi (Invoking gccgo): Document -fgo-importcfg.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/506095
|
|
In the Go 1.21 release the package internal/profile imports
internal/lazyregexp. That works when bootstrapping with Go 1.17,
because that compiler has internal/lazyregep and permits importing it.
We also have internal/lazyregexp in libgo, but since it is not installed
it is not available for importing. This CL adds internal/lazyregexp
to the list of internal packages that are installed for bootstrapping.
The Go 1.21, and earlier, releases have a couple of functions in
the internal/abi package that are always fully intrinsified.
The gofrontend recognizes and intrinsifies those functions as well.
However, the gofrontend was also building function descriptors
for references to the functions without calling them, which
failed because there was nothing to refer to. That is OK for the
gc compiler, which guarantees that the functions are only called,
not referenced. This CL arranges to not generate function descriptors
for these functions.
For golang/go#60913
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504798
|
|
This fixes an accidental omission in the determine types pass.
Test case is https://go.dev/cl/505015.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504797
|
|
The final argument to mmap, of type off_t, varies.
In CL 445375 we changed it to always use the C off_t type,
but that broke 32-bit big-endian Linux systems. On those systems,
using the C off_t type requires calling the mmap64 function.
In C this is automatically handled by the <sys/mman.h> file.
In Go, we would have to change the magic //extern comment to
call mmap64 when appropriate. Rather than try to get that right,
we instead go through a C function that uses C implicit type
conversions to pick the right type.
Fixes PR go/110297
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/504415
|
|
In CL 384695 I simplified the code that built lists of benchmarks,
examples, and fuzz tests, and managed to break it. This CL corrects
the code to once again make the benchmarks available, and to run
the examples with output and the fuzz targets.
Doing this revealed a test failure in internal/fuzz on 32-bit x86:
a signalling NaN is turned into a quiet NaN on the 387 floating-point
stack that GCC uses by default. This CL skips the test.
Fixes golang/go#60826
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/503798
|
|
As of https://go.dev/cl/476695 golang.org/x/sys/unix can call
syscall.prlimit, so we need such a function in libgo.
For golang/go#46279
Fixes golang/go#59712
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/486576
|
|
Backport CL 421442 from upstream.
Original description:
Arrange for tests that call setMimeInit to fully restore the old values,
by clearing the sync.Once that controls initialization.
Once we've done that, call initMime in initMimeUnixTest because
otherwise the test types loaded there will be cleared by the call to
initMime that previously was not being done.
For golang/go#51648
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/483117
|
|
In https://go.dev/cl/343873 we stopped padding zero-sized trailing
fields in functions that return multiple results where the last result
is zero-sized. This CL makes the corresponding change on the caller side.
The test case is https://go.dev/cl/479898.
Fixes golang/go#55242
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/479955
|
|
Fixes golang/go#59169
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/478176
|
|
This avoids clang warnings:
gcc/go/gofrontend/escape.cc:1290:17: warning: private field 'fn_' is not used [-Wunused-private-field]
gcc/go/gofrontend/escape.cc:3478:19: warning: private field 'context_' is not used [-Wunused-private-field]
gcc/go/gofrontend/lex.h:564:15: warning: private field 'input_file_name_' is not used [-Wunused-private-field]
gcc/go/gofrontend/types.cc:5788:20: warning: private field 'call_' is not used [-Wunused-private-field]
gcc/go/gofrontend/wb.cc:206:9: warning: private field 'gogo_' is not used [-Wunused-private-field]
Path by Martin Liška.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458975
|
|
Patch from Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/458396
|
|
PR go/108057
The current version is the same as for the previous GCC release,
but there have been minor changes like new type descriptors that
make it impossible to run Go programs built with the previous GCC
release with the current libgo.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/456976
|
|
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454275
|
|
This does the right thing for either glibc or musl on GNU/Linux.
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/454176
|
|
The last argument to the C mmap function is type off_t, not uintptr.
On some 32-bit systems, off_t is larger than uintptr.
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/445735
|
|
The compiler neglected to notice that a conversion from a string
constant to a string type was a valid string constant.
No test case because this only caused a compiler failure when compiling
without optimization, which is not the normal case, and is not a case
that we test.
Fixes golang/go#56113
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/441555
|
|
Instead of building the thunk struct type in the determine_types pass,
build it when we need it. That ensures that we are consistent in
determining whether an argument is constant.
We no longer need to add a field for a call to recover, as the
simplify_thunk_statements pass runs after the build_recover_thunks pass,
so the additional argument will already have been added to the call.
The test case is https://go.dev/cl/440297.
Fixes golang/go#56109
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/440298
|
|
Tighten up the argument type checking for Builtin_call_expression to
catch erroneous cases such as
panic(panic("bad")))
where an argument void type is being passed to panic/alignof/sizeof.
Fixes golang/go#56071.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/439815
|
|
Previously, libgo relied on the _sigev_un implementation-specific
field in struct sigevent, which is only available on glibc.
This patch uses the sigev_notify_thread_id macro instead which is
mandated by timer_create(2). In theory, this should work with any libc
implementation for Linux. Unfortunately, there is an open glibc bug
as glibc does not define this macro. For this reason, a glibc-specific
workaround is required. Other libcs (such as musl) define the macro
and don't require the workaround.
See https://sourceware.org/bugzilla/show_bug.cgi?id=27417
This makes libgo compatible with musl libc.
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/434755
|
|
In GCCGO and gollvm, the logic for allocating one byte for the last field is:
1. the last field has zero size
2. the struct itself does not have zero size
3. the last field is not blank
this commit adds the last two conditions to runtime.structToFFI.
For golang/go#55146
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/431735
|
|
This ports https://go.dev/cl/421879 to libgo. This is a quick port to
update gofrontend to work with the version of cgo in gc mainline.
A more complete port will follow, changing the gc version of cmd/cgo to
choose an approach based on feature testing the gccgo in use.
Updates golang/go#46731
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/432338
|
|
We were ignoring all functions starting with "__morestack_", but not
the function "__morestack" itself. Without this change, some tests
such as recover.go started failing recently, though I'm not sure
exactly what changed.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/427935
|
|
Musl defines SYS_timer_settime32, not SYS_timer_settime, on 32-bit systems.
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/420222
|
|
Avoid bash-specific ((expression)) syntax. As the bash syntax
converts a non-zero value to a zero status (and a zero value to a 1
status), and POSIX arithmetic expansion does not, we have to negate
the result.
Based on patch by Sören Tempel.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/419154
|
|
Removing this doesn't change anything at least with glibc 2.33.
The include was added in https://go.dev/cl/6100049 but it's not
clear why.
Fixes PR go/106266
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/417294
|
|
Fixes golang/go#53639
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/415936
|